Call a function: Difference between revisions
Content added Content deleted
Line 1,809: | Line 1,809: | ||
=={{header|EasyLang}}== |
=={{header|EasyLang}}== |
||
EasyLang distinguishes between subroutines and procedures. Procedures can have parameters and have local variables. Subroutines do not. The call syntax is the same. |
|||
<syntaxhighlight lang="easylang"> |
<syntaxhighlight lang="easylang"> |
||
func sqr n . |
|||
call somesubr # call a subroutine |
|||
return n * n |
|||
call someproc1 # call a procedure with no arguments |
|||
. |
|||
call someproc2 arg1 arg2 res # call a procedure with in-arguments and an inout-argument |
|||
sqr 3 |
|||
# |
|||
proc divmod a b . q r . |
|||
q = a div b |
|||
r = a mod b |
|||
. |
|||
divmod 11 3 q r |
|||
print q & " " & r |
|||
# |
|||
subr sqr2 |
|||
a = a * a |
|||
. |
|||
a = 5 |
|||
call sqr2 |
|||
print a |
|||
</syntaxhighlight> |
</syntaxhighlight> |
||