Re: questions, questions; always questions :)

new topic     » goto parent     » topic index » view thread      » older message » newer message

>you cannot do:
>   if (x*3) > y then blah
>but you can do:
>   return x*3 > y

Hmm... I know why this is, so I'll try to explain it...

"if" wants to return an atom, but "return" can return objects:

object x
atom y

x = {1, 2, 3, 4}
y = 7

if (x*3) > y then blah end if
-- {1, 2, 3, 4} * 3 = {3, 6, 9, 12}
-- {3, 6, 9, 12} > y = {0, 0, 1, 1}
-- "if" doesn't know if the result is true or false, so it doesn't work.

return x*3 > y
-- {1, 2, 3, 4} * 3 = {3, 6, 9, 12}
-- {3, 6, 9, 12} > y = {0, 0, 1, 1}
-- So, it's basically saying, "return {0, 0, 1, 1}", which is legal.


ICQ UIN: 17645603


_____________________________________________________________________
You don't need to buy Internet access to use free Internet e-mail.
Get completely free e-mail from Juno at http://www.juno.com
Or call Juno at (800) 654-JUNO [654-5866]

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu