Commit c8401519 authored by Luke  Thorpe's avatar Luke Thorpe
Browse files

Filled in 'Gap 2'

parent 9f70d8db
No preview for this file type
......@@ -365,7 +365,9 @@ The type of the expression given to the return statement must match the return t
Once the return statement is executed, the function is immediately exited.
\paragraph{Exit Statements:}
\hl{... ??? ...}
\hl{An exit statement }\lit{exit}\hl{ is used terminate the execution of the running program with a particular exit code. The statement is given an expression that must evaluate to a value with type }\lit{int}\hl{, with 0 and 1 typically denoting success and failure respectively.}
\hl{Upon encountering an exit statement, a program will terminate immediately after the given expression has been successfully evaluated; any code thereafter will be ignored. }
\fillgap{\hl{define exit statements}}{2 marks}
\paragraph{Print Statements:}
......
# exit instead of returning from a function
# Output:
# #empty#
# Exit:
# 42
# Program:
begin
char f() is
exit 42
end
char c = call f() ;
println c ;
exit 0
end
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment