Internal workings of Case
BlitzMax Forums/BlitzMax Programming/Internal workings of Case
| ||
Could Mark/BR confirm if each Case statement once matched now exits the Select/End Select structure? In previous versions this wasn't the case (excuse the pun) and each option was replaced with an If - which is slower because each If/Case has to be looked at before reaching End Select. C++ uses the break command for this - but the nearest command in Blitz is Exit - which exits the whole loop. If it does read all case statements could this optimization be introduced? |
| ||
In previous versions this wasn't the case Yes it was!..And is...Try this (in classic blitz and bmax)... a = 10 Select True Case a > 1 Print "bigger than 1" Case a > 2 Print "bigger than 2" Case a > 3 Print "bigger than 3" End Select Input EndAFAIR 'Select...Case' is treated as an 'If...ElseIf' block. |
| ||
Interesting. |
| ||
Yeah, Blitz has always exited on a match... |
| ||
Is there a command to stop it from exiting? *edit* Obviously if it is if based then no, but that sucks :P Proper select/case is much better. const someconst1 = 123 const someconst2 = 56 local condition = 56 select condition case 56,57,58,59 print "match range" continue case 56 print "match exact" continue case someconst2 print "match constant 1" continue case someconst1 print "match constant 2" continue default print "default match" end select rem would output match range match exact match constant 2 default match endrem |
| ||
LOL! |
| ||
Doesn't seem to have been missed much over the last 5 years (or 10-15 if you include Amiga Blitz)... |
| ||
Yeah its not the end of the world, its just annoying knowing that it is done in other languages. |