Похожие чаты

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

21 просмотр

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.

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

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

Господа, а что сейчас вообще с рынком труда на делфи происходит? Какова ситуация?
Rꙮman Yankꙮvsky
29
А вообще, что может смущать в самой Julia - бы сказал, что нет единого стандартного подхода по многим моментам, поэтому многое выглядит как "хаки" и произвол. Короче говоря, с...
Viktor G.
2
@Benzenoid can you tell me the easiest, and safest way to bu.y HEX now?
Živa Žena
20
This is a question from my wife who make a fortune with memes 😂😂 About the Migration and Tokens: 1. How will the old tokens be migrated to the new $LGCYX network? What is th...
🍿 °anton°
2
30500 за редактор? )
Владимир
47
а через ESC-код ?
Alexey Kulakov
29
What is the Dex situation? Agora team started with the Pnetwork for their dex which helped them both with integration. It’s completed but as you can see from the Pnetwork ann...
Ben
1
Гайс, вопрос для разносторонее развитых: читаю стрим с юарта, нада выделять с него фреймы с определенной структурой, если ли чо готовое, или долбаться с ринг буффером? нада у...
Vitaly
9
Anyone knows where there are some instructions or discort about failed bridge transactions ?
Jochem
21
@lozuk how do I get my phex copies of my ehex from a atomic wallet, to move to my rabby?
Justfrontin 👀
11
Карта сайта