|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
| Thread Tools | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
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 |
|
#2
|
|||||
|
|||||
|
Re: NOT condition in PBASIC?
Quote:
|
|
#3
|
|||
|
|||
|
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?
|
|
#4
|
|||||
|
|||||
|
Quote:
|
|
#5
|
||||
|
||||
|
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. |
|
#6
|
||||||
|
||||||
|
<> 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 |
|
#7
|
|||||
|
|||||
|
Quote:
Instead we do for bits plow_state = ~plow_state <- that works |
|
#8
|
||||
|
||||
|
Quote:
I think most bots are going to be similar. |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Obscure PBASIC for RoboEmu | rbayer | Programming | 1 | 28-03-2003 23:57 |
| PBasic 2.5 vs. 2.0 | Anthony Kesich | Programming | 6 | 09-02-2003 22:06 |
| The New PBASIC | rbayer | Programming | 10 | 07-01-2003 21:02 |
| Output voltage in PBASIC | diego25 | Programming | 7 | 31-01-2002 22:50 |
| Another PBASIC Question | Ian W. | Programming | 4 | 31-01-2002 21:36 |