Re: atom() ambiguity

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

Hello Alan,

>the second line here means:
>If the variable "line" is an atom then...
>Well, atom returns something.  Should this line be
>if atom(line) = 1 then
>This is because couldn't you write
>if atom(line) = 0 then
>Maybe if atom(line) then is a shorthand, but I don't think it is a
>good one
>because it is ambiguous.
>
>--Alan

    if atom(line) then
and
    if atom(line) = 1 then --(or 0)
are two different types of statements

if atom(line) returns 1 then
    if atom(line) then
would be the same as:
    if 1 then

1 means TRUE and 0 means FALSE so
    if 1 then
would execute the if statment and
    if 0 then
would skip over the if statement

however

    if atom(line) = 0
would execute the if statement if
line is not an atom and not if it is

You could say that
    if atom(line) then
is a shorter way to say
    if atom(line) = 1 then
but be careful that you know the difference
before you use them interchangably.

This is IMHO of course so I suppose there
could be other explanations.

Lewis Townsend
|\      ____ _     _     _ _    __
| \    | __/ ||   / |   // || / __ \
|  \   ||_   ||  //||  //  || ||__\|
|   \  | _|  || // || //   || \___ \
| |\ \ ||__  ||//  ||//    || |\__||
| | \ \|___\ |_/   |_/     || \____/
| |  \ \      _____    ________
| |   \ \     | __ \  | _   _ |
| |    \ \    ||__||  |/ | | \|
| |     \ \   | __ /     | |
| |______\ \  ||  \\     | |
|___________\ ||  ||     |_|
Keroltarr at hotmail.com

______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com

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

Search



Quick Links

User menu

Not signed in.

Misc Menu