test_goto.cmn 457 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. # Basic test for gotos/labels.
  2. >skip # try basic skip
  3. 0 10 "ERROR" -->
  4. !.
  5. ~:skip
  6. fun:
  7. 10
  8. ~:inFunc
  9. 20
  10. >outOfFunc
  11. 30
  12. 0 10 "ERROR" -->
  13. .
  14. # loop made with gotos:
  15. 0 10 "test loop:" -->
  16. 10 # 10 iterations
  17. ~:loopStart
  18. $0 !! ? >loopEnd .
  19. 0 10 "- in loop" -->
  20. --
  21. >loopStart
  22. ~:loopEnd
  23. # try jump into a function
  24. 0 "try to jump inside a function: " -->
  25. >inFunc
  26. ~:outOfFunc
  27. 20 = ?
  28. "OK" -->
  29. ;
  30. "ERROR" -->
  31. .
  32. 10 ->
  33. 0 10 "all seems OK" -->