QUIT Command

Material prepared from M Programming Book [WALTERS1997] (Page 103) and GT.M Programmer’s Guide

Description

QUIT VALUE

QUIT terminates execution of current stack and returns control.

When used in a FOR loop it terminates the execution of the loop.

Examples

LABEL1
 WRITE "Patient Name",NAME,!
 WRITE "Address",ADDRESS,!
 QUIT

WRITE "Send to execute",!
DO LABEL1
WRITE "Returned from action",!

The DO command will start the execution of the code indicated by LABEL1. The lines of code following LABEL1 will be executed in sequential order, and when QUIT is encountered, the control will be returned to the calling code.

FOR I=1:1 DO  QUIT:I>7
. WRITE " I= ",I
. WRITE " I Square= ",I*I,!

Notice that there are two spaces between DO and QUIT.