NXC: ... display print output problem

Discussion specific to NXT-G, NXC, NBC, RobotC, Lejos, and more.
Post Reply
HaWe
Posts: 2500
Joined: 04 Nov 2014, 19:00

NXC: ... display print output problem

Post by HaWe »

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:

Re: NXC: ... display print output problem

Post by muntoo »

I suspect it's because it expects a string/variable. Not a bracket.
Image

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:

Re: NXC: ... display print output problem

Post by afanofosc »

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
Multi-platform LEGO MINDSTORMS programming
http://bricxcc.sourceforge.net/
Post Reply

Who is online

Users browsing this forum: Semrush [Bot] and 1 guest