fork(1) download
  1. def switchExample(option):
  2. def firstOption():
  3. print("First output!")
  4. print("Second output!")
  5. return 1
  6. def secondOption():
  7. print("Lol")
  8. return 2
  9. options = {
  10. 0 : firstOption,
  11. 1 : secondOption,
  12. }[option]
  13.  
  14. if(options != None):
  15. return options()
  16.  
  17. print(switchExample(0))
  18. print(switchExample(1))
Success #stdin #stdout 0.15s 10264KB
stdin
Standard input is empty
stdout
First output!
Second output!
1
Lol
2