A2osX/EXAMPLES/EXITDEMO.txt
2019-11-23 22:07:04 -05:00

38 lines
737 B
Plaintext
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

NEW
PREFIX
AUTO 4,1
#!/BIN/SH
#
# EXIT Command Examples
#
# This example shows the use of EXIT from a function with a return code
#
FUNCTION DIVIDE
{
IF ![ -I $A ] OR ![ -I $B ]
# Error not vars not integers
EXIT 3
FI
IF [ $B -EQ 0 ]
# Error Zero Divisor
EXIT 7
FI
SET $3 = $A / $B
}
READ -P "\nEnter a number: " A
READ -P "\nAnother number: " B
CALL DIVIDE $A $B C
SWITCH $?
CASE 0
ECHO "\n$A divided by $B is $C\n"
BREAK
CASE 3
ECHO "\nError: Input not Integers\n"
BREAK
CASE 7
ECHO "\nError: Divide by Zero Prohibitied\n"
BREAK
END
MAN
TEXT /MAKE/USR/SHARE/EXAMPLES/EXITDEMO