Icon+Unicon/Intro: Difference between revisions

Line 236:
 
=== Procedure Controls ===
====return expr====
Return the results of 'expr' (the default value of 'expr' is ''&null''). Apart from the usual meaning of ''return'', if the ''expr'' fails, then the procedure fails as well. See [[Icon%2BUnicon/Intro#Failure_is_an_Option|Failure is an Option]] above. If the ''expr'' is capable of yielding more than one result, only the first result is used.
 
====fail====
Causes the the enclosing procedure to terminate without returning value. This is different from returning void or a null value that many other languages do when the code does not return an actual value.
Line 245 ⟶ 242:
x := arglist[i] # Succeeds assigning x the value of arglist[i] or fails (leaving x unchanged) if i is out of bounds.
write(x)</lang>
 
====return expr====
Return the results of 'expr' (the default value of 'expr' is ''&amp;null''). Apart from the usual meaning of ''return'', if the ''expr'' fails, then the procedure fails as well. See [[Icon%2BUnicon/Intro#Failure_is_an_Option|Failure is an Option]] above. If the ''expr'' is capable of yielding more than one result, only the first result is used.
 
====suspend expr====
Line 250:
 
A procedure can contain several uses of ''suspend'' and it's quite reasonable for the procedure to execute many of them in any chosen order.
 
=== Looping Controls ===
====next====
Anonymous user