Author |
Message |
ynotpeace
|
Posted: 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 |
|
|
|
|
![](images/spacer.gif) |
Sponsor Sponsor
![Sponsor Sponsor](templates/subSilver/images/ranks/stars_rank5.gif)
|
|
![](images/spacer.gif) |
TerranceN
|
Posted: 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 |
|
|
|
|
|
![](images/spacer.gif) |
Insectoid
![](http://compsci.ca/v3/uploads/user_avatars/13760332514cbd0ce972eaa.jpg)
|
Posted: 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. |
|
|
|
|
![](images/spacer.gif) |
ProgrammingFun
![](http://compsci.ca/v3/uploads/user_avatars/11682880074bcb590d30b0a.png)
|
Posted: Wed Feb 10, 2010 5:48 pm Post subject: RE:A "not" command in If Statements |
|
|
Turing also uses != in its language. |
|
|
|
|
![](images/spacer.gif) |
TheGuardian001
|
Posted: 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. |
|
|
|
|
![](images/spacer.gif) |
USEC_OFFICER
![](http://compsci.ca/v3/uploads/user_avatars/16624966004bb548179e82e.png)
|
Posted: Wed Feb 10, 2010 9:25 pm Post subject: RE:A "not" command in If Statements |
|
|
Really? ~= is equal to not=? Interesting... |
|
|
|
|
![](images/spacer.gif) |
SNIPERDUDE
![](http://compsci.ca/v3/uploads/user_avatars/16932914504cbd0ad6ceaf1.jpg)
|
Posted: 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. |
|
|
|
|
![](images/spacer.gif) |
|