Похожие чаты

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 ответов

17 просмотров

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.

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

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

Ready for some fun AND a chance to win TKO Tokens? Join us for exciting minigames in our Telegram group! 🕒 Don’t miss out—games start on today 25 October 2024, at 8 PM! Ge...
Milkyway | Tokocrypto
255
Добрый вечер. Есть вопрос, а может и предложение. Был у меня диалог в другой группе о делфи и я задался вопросом: "А нельзя ли в делфи цвет //коментария и {комментария} сде...
Kraszx
24
Всем привет! Подскажи, пожалуйста, как передать в TComboBox сразу значение и id записи. На Delphi я делал так: ComboBox1.Items.AddObject('Какое-то значение', Pointer(id запис...
Евгений
13
Мдя, прикол, боевая сборка запускается (именно под отладчиком) после F9 примерно полторы минуты (97 секунд если быть точным). Начал копать - проблема детектится сразу - зависа...
Александр (Rouse_) Багель
38
How are we going bro about the Raids ??
🅿️abby_FX
13
я так понимаю, я так подозреваю, что создание такого плагина для человека, кто умеет писать плагины для делфи потребует минут 5-10 времени. но это мое подозрение. хотелось бы ...
Kraszx
7
Товарищи, кто работа с iphelper? Или может я в самой логике ошибки фигачу, не пойму.... var ifTable : PMIB_IFTABLE; size, corSize: DWORD; Buffer ...
Warfarellen
4
Здравствуйте, вопрос по структурам данных. Были у вас случаи, когда пришлось писать деревья или двунаправленные списки?
/ /
50
Keep saying it, it’s Trump or WW3. Iran will be emboldened if Harris wins by cheating. Israel will have to take the initiative against Iran. How has BTC faired everytime the...
Adz | Ferrum Network Product & Service Consultant @ Ferrum Network
1
Коллеги, добрый вечер. Создаю коллекцию от TFPGMap, ключ - перечисление, значение - целое. Нужно отсортировать коллекцию по значению. Как это можно сделать?
Kirill Filippenok
11
Карта сайта