odd number and even numbers

Colin Holgate coiin at rcn.com
Mon Aug 17 15:55:19 EDT 2009


Another approach is to use Step in your repeat loop. See this:

on test
    repeat with a = 1 to 10 step 2
       put return & a*3 after msg
       put return & sqrt(a+1) after msg
    end repeat
end test

For odd numbers a*3 will be put, and for even numbers the square root  
of the number will be put. Doing it that way involves no if  
statements, and no function calls.





More information about the use-livecode mailing list