fork download
  1. case "charlie"
  2. of "alfa":
  3. echo "A"
  4. of "bravo":
  5. echo "B"
  6. of "charlie":
  7. echo "C"
  8. else:
  9. echo "Unrecognized letter"
  10.  
  11. case 'h':
  12. of 'a', 'e', 'i', 'o', 'u':
  13. echo "Vowel"
  14. of '\127'..'\255':
  15. echo "Unknown"
  16. else:
  17. echo "Consonant"
  18.  
  19. proc positiveOrNegative(num: int): string =
  20. result = case num:
  21. of low(int)..-1:
  22. "negative"
  23. of 0:
  24. "zero"
  25. of 1..high(int):
  26. "positive"
  27. else:
  28. "impossible"
  29.  
  30. echo positiveOrNegative(-1)
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.nim(20, 15) Error: expression expected, but found 'case'
stdout
Standard output is empty