Variable-to-variable binding, scope.


%%% Value store: variable to variable binding
declare
Z
U = Z

{Browse Z}
{Browse U}

declare
thread {Delay 15000} Z = 5 end

%% Variable scope: 
declare
X = 6
fun {F X}
   {Browse inF}
   {Browse X}
   X %% a function must return something
end

{Browse {F 2}} %% function return value must be used
%% The function parameter is an atom: 
{Browse {F hello}} %% we can call F with different types of X
{Browse X}

declare
fun {G Y}
   {Browse inG}
   {Browse X}
   {Browse Y}
   Y
end

{Browse {G 2}}
{Browse {G hello}}

CSci 4651 course web site.

The views and opinions expressed in this page are strictly those of the page author. The contents of this page have not been reviewed or approved by the University of Minnesota.