DADiSP Worksheet Functions > Function Categories > Control Flow > WAITKEY
Pauses execution of an SPL function until a key is pressed.
WAITKEY
Assume the following function definition, power, is loaded.
Then, type the following at the command line:
power(2, 8)
The value 1 is returned, and the power function pauses until any key is pressed. Pressing the spacebar after each new value is displayed steps through the loop, and displays the following series of intermediate values for the variable, p: 1, 2, 4, 8, 16, 32, 64, 128, 256. 2 raised to the 8th power (i.e. 28) equals 256.
The WAITKEY function is useful for debugging and testing custom SPL functions.
The WAITKEY function is similar to the command file keyword @WAITKEY.
See DEBUG to invoke the SPL debugger.