tlinearscanend.nim 374 B

123456789101112131415161718192021222324252627
  1. discard """
  2. action: compile
  3. """
  4. import strutils
  5. var x = 343
  6. case stdin.readline.parseInt
  7. of 0:
  8. echo "most common case"
  9. of 1:
  10. {.linearScanEnd.}
  11. echo "second most common case"
  12. of 2: echo "unlikely: use branch table"
  13. else:
  14. echo "unlikely too: use branch table"
  15. case x
  16. of 23: echo "23"
  17. of 343: echo "343"
  18. of 21: echo "21"
  19. else:
  20. {.linearScanEnd.}
  21. echo "default"