Computer Science Canada

A "not" command in If Statements

Author:  ynotpeace [ Tue Feb 09, 2010 6:07 pm ]
Post subject:  A "not" command in If Statements

What is it you are trying to achieve?


I'm not too familiar with turing so I'm asking:
is there a "not" command for if statements?
for example:
if X "doesn't equal" Y Then

end if

Thanks for your help

Author:  TerranceN [ Tue Feb 09, 2010 6:27 pm ]
Post subject:  RE:A "not" command in If Statements

There are two ways to do this:

Turing:
var x : int := 5

if x not= 10 then
    put "a"
end if

if not (x = 10) then
    put "b"
end if

Author:  Insectoid [ Tue Feb 09, 2010 8:04 pm ]
Post subject:  RE:A "not" command in If Statements

Turing also accepts the sqiggle (~) as 'not'

if this ~= that


Most languages use ! as not, Turing just likes to be different.

Author:  ProgrammingFun [ Wed Feb 10, 2010 5:48 pm ]
Post subject:  RE:A "not" command in If Statements

Turing also uses != in its language.

Author:  TheGuardian001 [ Wed Feb 10, 2010 6:12 pm ]
Post subject:  Re: A "not" command in If Statements

No it doesn't. Trying to run code with a != results in an invalid character error.

Author:  USEC_OFFICER [ Wed Feb 10, 2010 9:25 pm ]
Post subject:  RE:A "not" command in If Statements

Really? ~= is equal to not=? Interesting...

Author:  SNIPERDUDE [ Wed Feb 10, 2010 11:33 pm ]
Post subject:  RE:A "not" command in If Statements

Yup. Consider it a shortcut, like procedure can be typed as proc, function as fcn, etc.


: