tnestif.nim 355 B

12345678910111213141516171819202122232425
  1. discard """
  2. file: "tnestif.nim"
  3. output: "i == 2"
  4. """
  5. # test nested ifs
  6. var
  7. x, y: int
  8. x = 2
  9. if x == 0:
  10. write(stdout, "i == 0")
  11. if y == 0:
  12. write(stdout, x)
  13. else:
  14. write(stdout, y)
  15. elif x == 1:
  16. write(stdout, "i == 1")
  17. elif x == 2:
  18. write(stdout, "i == 2")
  19. else:
  20. write(stdout, "looks like Python")
  21. #OUT i == 2