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

Yahoo! Groups Tips

Did you know...
Show off your group to the world. Share a photo of your group with us.

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
and,or,not   Message List  
Reply | Forward Message #280 of 712 |
MKE 6.7 (Aug/5/2005) permits the use of and,or,not
in "if" statements. The propositions associated
with and,or,not are enclosed in braces.
The example below shows the correct syntax,
and the "alternate version" in the comments shows
how to achieve the same result without using and,or,not.

# KEHOME/test/andornot.ku
# Aug/5/2005

# test and,or,not in if statement
# alternate versions do not use and,or,not


add whole number isa method with
# Product = $1 + $2 for whole numbers (non-negative integers)
# simulate human method
format=[whole number:1, whole number:2],
local=[answer],
meaning={
if {$1 is 0;} and {$2 is 0;}; then set answer = 0; fi;
if {$1 is 0;} and not {$2 is 0;}; then set answer = $2; fi;
if not {$1 is 0;} and {$2 is 0;}; then set answer = $1; fi;
if not {$1 is 0;} and not {$2 is 0;}; then answer := do add natural number
od $1,$2 done; fi;
# alternate version 1
#if $1 is 0; then if $2 is 0; then set answer = $2; fi;fi;
#if $1 is 0; then if $2 is 0; else set answer = $2; fi;fi;
#if $1 is 0; else if $2 is 0; then set answer = $1; fi;fi;
#if $1 is 0; else if $2 is 0; else answer := do add natural number od $1,$2
done; fi;fi;
# alternate version 2
#if $1 is 0; then set answer = $2;
#else if $2 is 0; then set answer = $1;
#else answer := do add natural number od $1,$2 done;
#fi; fi;
set Product=$answer;
};

add natural number iss method with
# Product = $1 + $2 for natural numbers (positive integers)
# simulate human method
format=[natural number:1,natural number:2],
local=[count,answer],
meaning={
set echo=off;
set count = 1;
answer := do increase od $1 done;
until $count is $2 {
count := do increase od $count done;
answer := do increase od $answer done;
};
set echo=on;
set Product = $answer;

};

increase is method with
# Product = $1 + 1 for numbers (integers)
format=[number:1],
meaning={
# use MKE built-in method
do sum od $1,1 done;
};


# tests
do add whole number od 0,8 done;
do add whole number od 5,0 done;
do add whole number od 0,0 done;
do add whole number od 5,8 done;
do add whole number od 12,23 done;

#exit;

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





Fri Aug 5, 2005 8:20 pm

rhmcc
Offline Offline
Send Email Send Email

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

MKE 6.7 (Aug/5/2005) permits the use of and,or,not in "if" statements. The propositions associated with and,or,not are enclosed in braces. The example below...
Richard H. McCullough
rhmcc
Offline Send Email
Aug 5, 2005
8:23 pm
Advanced

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