Post

GnarlyRedDwarf
GnarlyRedDwarf@GnarlyRedDwarf·
@PythonPr i’ve no idea. I use switch cases for anything non-trivial and enumerable. A switch statement means the compiler will tell you if you missed one. It’s a far better pattern for any kind of finite state conditional. .
English
0
0
5
947
Lex
Lex@devmatixx·
@PythonPr I don't think a lot of people even knows a bout switch case.
English
0
0
6
776
Gopuff
Gopuff@gopuff·
There's no middleman here to mark things up. Orders come straight from our shelves to you in as fast as 15 minutes.
English
36
62
1.1K
32.1M
Daniel Daniel
Daniel Daniel@DanielD83014685·
@PythonPr Not allways. If the options are too many switch case is allways the best.
English
0
0
2
416
The Retro Foxbard's Tail
The Retro Foxbard's Tail@TheFoxBard·
I started old school on the C64 with the IF/THEN/ELSE and BNE/BEQ in 6502 Assembly. Personal rules I follow to not get caught in if/else and switch/case hell: 1. A 'if' or individual 'cases' logic should never exceed more than five lines in length ,not including the break or return. 2. 'If/else' is always looking at a boolean test result, treat it as such. 3. Get the result and hand-off to a function or return/transform the data itself if it doesn't violate rule #1. 4. use 'switch(match)/case' if a quick check on an object and its value is needed and if the objects value can be more than 2 values. Then hand off to a function following rule #1. As always keep it SOLID :)
English
0
0
1
300
Nico Erdmann
Nico Erdmann@stdvectorint42·
@PythonPr kotlin so autistic that needed to use 'when' instead of 'switch'
English
0
0
1
1K
BIGO LIVE
BIGO LIVE@BIGOLIVEapp·
Up late and bored? Tap into live conversations.
English
51
38
567
7.7M
intern
intern@ekemini58110·
@PythonPr I also love if else 😂
English
0
0
1
287
George Huang
George Huang@OeyGeorge·
@PythonPr `switch-case` is much faster, while `if-else` is highly flexible. I usually use both, sometimes even together in complex decision making scenarios.
English
0
0
1
321
Tux.Lector
Tux.Lector@LectorTux·
@PythonPr Not working with Python, but `match` is heaven.
English
0
0
1
570
Flight
Flight@TurquoiseDarren·
@PythonPr I think it's time to change semantics. unless (x = 1) { // when x is not 1 } otherwise { // when x is 1 }
English
0
0
1
132
eS.eS.Aye
eS.eS.Aye@ShamsShahidAyub·
@PythonPr The "switch" case is a higher level of abstraction.... 🫥
English
0
0
1
669
Polymarket
Polymarket@Polymarket·
Free $50 on your first trade
English
42
39
336
10.5M
Seemi Rauf
Seemi Rauf@Seemi_Rauf·
@PythonPr İt's more close to the real life scenarios
English
0
0
1
196
punund 🫧
punund 🫧@punund·
@PythonPr because most of them are barely out of high school
English
0
0
1
163
BlackRay
BlackRay@nowayoutonline·
@PythonPr if there are so many cases you want to use "switch case" a map is always more clear
English
0
0
1
201
kitgum
kitgum@brixkitkam·
@PythonPr I also wonder. Switch is so powerful.
English
2
0
0
896
Michael Peltniker
Michael Peltniker@AnoN100101001·
@PythonPr If else is more appropriate for most cases than switch case. Switch case is truly efficient but all depends on how and where its used for.
English
0
0
0
200
Max
Max@MaxGamingLV·
@PythonPr Because it only makes sense
English
0
0
0
130
Paylaş