Subject:
|
Semicolon (;) Confusion
|
Newsgroups:
|
lugnet.robotics
|
Date:
|
Fri, 27 Oct 2000 18:05:38 GMT
|
Viewed:
|
773 times
|
| |
| |
In some cases Mark Overmars great RCX Command Center does not flag syntax
errors for incorrect use of an ending semicolon, as in the example below.
Could someone please explain how semicolons work in NQC? Perhaps there is a
good reason for *not* flagging syntax errors in those cases.
//a flasher program
task main()
{
SetSensor(SENSOR_1,SENSOR_TOUCH);
while (true) // A semicolon here disables program
{
if (SENSOR_1 == 1) //a semicolon here runs the flasher all the time
{
On (OUT_B);
Wait (10);
Off (OUT_B);
Wait (100);
}
}
}
Jerry
|
|
Message has 1 Reply: | | Re: Semicolon (;) Confusion
|
| (...) NQC implements a syntax similar to C. In C, while and if statements have a single statement that is executed if the condition is true. A null statement is a valid statement, and a block of statements enclosed in {} can be substituted or a (...) (24 years ago, 27-Oct-00, to lugnet.robotics)
|
3 Messages in This Thread:
- Entire Thread on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
|
|
|
Active threads in Robotics
|
|
|
|