Discussion specific to NXT-G, NXC, NBC, RobotC, Lejos, and more.
HaWe
Posts: 2500 Joined: 04 Nov 2014, 19:00
Post
by HaWe » 04 Jan 2011, 21:20
hi,
I just came upon this issue:
this code works:
Code: Select all
for (int z=0;z<8;z++) {
NumOut(0,56-(z*8), (z&4)?1:0);
}
but this not:
Code: Select all
for (int z=0;z<8;z++) {
TextOut(0,56-(z*8), (z&4)?"TRUE":"FALSE");
}
why not?
muntoo
Posts: 834 Joined: 01 Oct 2010, 02:54
Location: Your Worst Nightmare
Contact:
Post
by muntoo » 06 Jan 2011, 03:33
I suspect it's because it expects a string/variable. Not a bracket.
Commit to LEGO Mindstorms Robotics Stack Exchange:
bit.ly/MindstormsSE
Commit to LEGO Stack Exchange:
bit.ly/Area51LEGOcommit
afanofosc
Site Admin
Posts: 1256 Joined: 26 Sep 2010, 19:36
Location: Nashville, TN
Contact:
Post
by afanofosc » 06 Jan 2011, 18:02
The way that I implemented this function in the compiler makes it not work for ?: expressions. What happens if you try using ?': when passing a string into a user defined function? I think ?: may not be fully is not supported for string expressions.
John Hansen
Users browsing this forum: Semrush [Bot] and 2 guests