Discussion specific to NXT-G, NXC, NBC, RobotC, Lejos, and more.
-
HaWe
- Posts: 2500
- Joined: 04 Nov 2014, 19:00
Post
by HaWe »
hi,
I'm getting a compiler error with this line:
Code: Select all
int SoundLevel, BGrndNoise, p;
SoundLevel<BGrndNoise ? p++ : p=0;
# Error: Invalid assignment
File "c:\Temp\temp.nxc" ; line 43
# SoundLevel<B
#----------------------------------------------------------
# Error: ';' expected
File "c:\Temp\temp.nxc" ; line 43
# SoundLevel<B
#----------------------------------------------------------
what may be wrong (Bricxcc 3.3.8.9. 2010-11-03)
-
afanofosc
- Site Admin
- Posts: 1256
- Joined: 26 Sep 2010, 19:36
- Location: Nashville, TN
-
Contact:
Post
by afanofosc »
Seems like this is not a supported form of the ?: expression as I implemented it in NXC. Try this instead:
Code: Select all
p = SoundLevel<BGrndNoise ? p+1 : 0;
John Hansen
-
HaWe
- Posts: 2500
- Joined: 04 Nov 2014, 19:00
Post
by HaWe »
thx, this works :)
Users browsing this forum: No registered users and 2 guests