-
Notifications
You must be signed in to change notification settings - Fork 0
Switch Case
Ariel Balter edited this page Mar 31, 2016
·
2 revisions
Even looks like a switch case
http://stackoverflow.com/questions/60208/replacements-for-switch-statement-in-python
# simple case alternative
some_value = 5.0
# this while loop block simulates a case block
# case
while True:
# case 1
if some_value > 5:
print ('Greater than five')
break
# case 2
if some_value == 5:
print ('Equal to five')
break
# else case 3
print ( 'Must be less than 5')
break
Other ideas: