Exiting
You may exit a word at any time using the word
EXIT. For example:
: halfway "hello" . EXIT "goodbye" . ;
Quiz
Question 1
Run theHALFWAYprogram. Does "goodbye" print to the console? Can you explain? How would you amend
HALFWAYso that it prints "goodbye" as well?
: halfway "hello" . EXIT "goodbye" . ; : noexit "hello" . "goodbye" . ; halfway cr \ hello noexit cr \ hello goodbye
exitwill leave the execution of a word. Therefore, the remaining code of
halfwayare not executed.