Похожие чаты

Please tell me how to shorten it? studentCounter counts how

many student IDs have passed, you need to pull out the next groupId for every 3 students

12 ответов

9 просмотров

oh god...

Seems like rules pattern is applicable here

look, I don’t know C#, I’m a Go’pher so please excuse me for sharing Go code but that is the fastest I can help: https://play.golang.org/p/R4H55fbkVcb 1. the code you wrote is terrible because you hardcoded all rules, which is really really bad. You want rules to be dynamically configurable. 2. you just iterate over a sorted (by max student count) list of rules until you pick one that suits the number at hand.

few notes here..... 1. groups is an unsorted list. Who knows what order they'll be in when you get them. Also, List().ToList()... what? 2. if you simply need to group 3 students at a time, use math var groupNumber = (studentNumber / 3) + 1 example: student 10, divide by 3 = 3, plus 1 = 4, this student is in group 4. 3. Group size should be a configurable variable, as @Romshark was saying, hardcoding = bad. 4. what the heck is going on in that for loop? Barring all of that, could you instead tell us what the expected end result is?

Another thought, you are assuming there are enough groups to handle the number of students it seems. If I only have 3 groups and send 20 students in, that's going to be an issue. You need to handle that.

Roman Sharkov
look, I don’t know C#, I’m a Go’pher so please exc...

OT, i love the fact that go as has its own "playground"

getAx
OT, i love the fact that go as has its own "playgr...

we also have a more advanced playground for analyzer and nuget developers https://sharplab.io/

getAx
Nothing official tho

There's also https://try.dot.net/

Shafiq Jetha
There's also https://try.dot.net/

That looks official, never seen it before

getAx
That looks official, never seen it before

Yep. It was released maybe 9 or 10 months ago.

Похожие вопросы

Обсуждают сегодня

Всем привет, написал код ниже, но он выдает сегфолт, в чем причина? #include <stdio.h> #include <stdlib.h> #include <string.h> struct product { char *name; float price; };...
buzz базз
32
Хотел бы спросить у знающих, правильную ли я выбрал книгу для начала изучения ассемблера Юрова В.И ? Или есть более лучшие книги для начала обучения?
Botsman
25
Добрый день, не подскажите, если в OC-V3 поменять страндартную директорию /storage/ на /storage2/ - не будет сильно много проблем ?
Max Dubovsky
32
Conversation at a festival with a non-crpto person (not a normie by any stretch, though): * person: tell me about crypto, me: ok, the original idea is p2p sound money for the...
molecular#123 🐓
25
Книга Юрова В.И пойдёт для обучения?
Botsman
24
$params = [ 'formid' => 'feedbackForm', 'formTpl' => '@CODE: <form class="form-validate" data-id="ajax_form"> <fieldset class="margin-bottom-md"> ...
Pathologic
1
> Примечательно, что новый владелец удаляет из GitHub любые жалобы, указывающие на подозрительную активность или смену владельца, и, видимо, рассчитывает на то, что пользовате...
Alex Sherbakov
1
I bought some PHA tokens on Kucoin, which is the best wallet to store and easy to use?
AMR
19
'frakturBold' => ['𝖆', '𝖇', '𝖈', '𝖉', '𝖊', '𝖋', '𝖌', '𝖍', '𝖎', '𝖏', '𝖐', '𝖑', '𝖒', '𝖓', '𝖔', '𝖕', '𝖖', '𝖗', '𝖘', '𝖙', '𝖚', '𝖛', '𝖜', '𝖝', '𝖞', '𝖟', '𝕬', '𝕭', '𝕮', '𝕯'...
Roma
4
Подскажите пожалуйста, а я могу вот такую штуку использовать? rpc, только реализованное в реббите https://www.rabbitmq.com/tutorials/tutorial-six-php ( или https://habr.com/ru...
Artyom
11
Карта сайта