Advertisement
Mesaif

TURING - CH4_Ex5

May 11th, 2016
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. %Loops infinetly and announces loop repetition number when user types 'more'
  2.  
  3. %VARIABLES
  4. var loopcount : int := 1
  5. var input : string
  6.  
  7. %Main Loop
  8. loop
  9. put "Loop execution #", loopcount
  10. delay (250)
  11. put "Type 'more' to continue, type 'exit' to exit"
  12. get input
  13.  
  14. if input = "more" then %Restart loop when user types "more"
  15. delay (500)
  16.  
  17. elsif input = "exit" then %End loop when user types "Exit"
  18. exit
  19.  
  20. else %Give a message when the user doesnt give a set response
  21. put "command not recognised"
  22. loopcount:= 0
  23. put " "
  24. end if
  25. loopcount += 1
  26. put " "
  27. end loop
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement