Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Oz (programming language)
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
====Procedures==== Functions in Oz are supposed to return a value at the last statement encountered in the body of the function during its execution. In the example below, the function Ret returns 5 if X > 0 and -5 otherwise. <syntaxhighlight lang="erlang"> declare fun {Ret X} if X > 0 then 5 else ~5 end end </syntaxhighlight> But Oz also provides a facility in case a function must not return values. Such functions are called procedures.<ref>{{Cite web|url=https://mozart.github.io/mozart-v1/doc-1.4.0/tutorial/node5.html#control.procedure|title = 5 Basic Control Structures}}</ref> Procedures are defined using the construct "proc" as follows <syntaxhighlight lang="erlang"> declare proc {Ret X} if X > 0 then {Browse 5} else {Browse ~5} end end </syntaxhighlight> The above example doesn't return any value, it just prints 5 or -5 in the Oz browser depending on the sign of X.
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)