![]() |
NOT condition in PBASIC?
In C++ there is a condition, AND NOT which uses the syntax "!".
An example of this is: variable!=2 is there any ! command in PBASIC? If not, what syntax would I use to say "IF lightSensor1 DOES NOT EQUAL 1 THEN..." thanks |
Re: NOT condition in PBASIC?
Quote:
|
Can you use the ~= between 2 variables? Where I need this, i need to say "rc_sw15~=lightOn_prev" where lightOn_prev is either a 1 or a 0. This gives me an error, saying "expected a binary operator or ")"". Can i not use this syntax between 2 varialbes or only a variable and a constant?
|
Quote:
|
Trust me when I tell you that the not symbol in BASIC is simply the word 'NOT', at least when it is at the beginning of a statement. We have fallen into the habit of writing our code to emulate C++ style if statements by using the not command:
if NOT (condition) THEN SkipifA statement SkipifA: I know the new compiler uses C++ style if commands, but we decided not switch to a beta version. We just don't trust it enough. |
<> is the same as C/C++'s !=. For example:
if p1_y <> 127 then doStuff is the same as if NOT (p1_y=127) then doStuff |
Quote:
Instead we do for bits plow_state = ~plow_state <- that works |
Quote:
|
| All times are GMT -5. The time now is 17:52. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi