Search the web
Sign In
New User? Sign Up
KR-language
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Want your group to be featured on the Yahoo! Groups website? Add a group photo to Flickr.

Best of Y! Groups

   Check them out and nominate your group.
Having problems with message search? Fill out this form to ensure your group is one of the first to be migrated to the new message search system.

Messages

  Messages Help
Advanced
local variables in methods and relations   Message List  
Reply | Forward Message #277 of 712 |
MKE 6.7 (Jul/31/2005) provides for local variables
in methods and relations. Local variables are useful
for avoiding name conflicts when executing nested
methods. Local variables are undefined outside of
the method or relation.

By default, MKR variables are global. To define
local variables, use the "local" attribute of the
method or relation. For example:

# KEHOME/test/local.ku
# Jul/31/2005

# test local variables in methods and relations
set debug=local;

do print od $count,$answer done;
add is method with
format=[number:1,number:2],
local=[count,answer],
meaning={
# simulate human method
set count = 0;
set answer = $1;
do print od $count,$answer done;
until $count is $2 {
count := do increase od $count done;
answer := do increase od $answer done;
do print od $count,$answer done;
};
set Product = $answer;
};
increase is method with
format=[number:1],
meaning={
# use MKE built-in method
do sum od $1,1 done;
};

# test
do add od 2,3 done;
do print od $count,$answer done;

Dick McCullough
knowledge := man do identify od existent done;
knowledge haspart proposition list;
http://rhm.cdepot.net/




Sun Jul 31, 2005 6:43 pm

rhmcc
Offline Offline
Send Email Send Email

Forward
Message #277 of 712 |
Expand Messages Author Sort by Date

MKE 6.7 (Jul/31/2005) provides for local variables in methods and relations. Local variables are useful for avoiding name conflicts when executing nested ...
Richard H. McCullough
rhmcc
Offline Send Email
Jul 31, 2005
6:44 pm
Advanced

Copyright © 2009 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines - Help