|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
||||
|
||||
|
Re: Ternary operators
I think it can also contribute to global warming...
![]() |
|
#2
|
|||
|
|||
|
Re: Ternary operators
Not to mention put your robot overweight...
![]() |
|
#3
|
|||
|
|||
|
Re: Ternary operators
we used them a couple of times, primarily where an if statement would be inconvenient, or when we are trying to count outputs (if could result in double counting).
some of our mentors really don't appreciate them, so using them is kinda limited |
|
#4
|
||||
|
||||
|
Re: Ternary operators
I use them like sprinkles, with verbose comments following them
|
|
#5
|
||||
|
||||
|
Re: Ternary operators
Quote:
|
|
#6
|
|||
|
|||
|
Re: Ternary operators
Quote:
The XOR, on the other hand, would make even someone familiar with that operator stop and think, "now what could he possibly be doing here?" Quote:
Code:
C.lcd.lines[0] = "compressor:" + (comp.getPressureSwitchValue()
? "off"
: "on");
C.lcd.lines[1]= "SideKicker: " + (C.sideKickLoaded < 0
? "released"
: "loaded");
Code:
roller.set(C.rollerSpeed * (C.rollerForward
? 1
: -1));
Code:
// If they're up, don't bother
fDrive.set(C.upFront
? C.fDrive
: 0);
bDrive.set(C.upBack
? -C.bDrive
: 0);
![]() |
|
#7
|
|||
|
|||
|
Re: Ternary operators
Quote:
Also, for text output, the reason the compressor line has NO spaces at all is that with 2 4-character tabs (class and method) we were squeezing for 80 columns (something which I am also a nazi for). * although, it does look like some spacing got messed up when tweaking numbers in autonomous. I'll fix this and update it today or tomorrow. (that URL is always the newest version) |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Calling all Hams--Amateur Radio Operators | Covey41 | General Forum | 8 | 09-04-2007 19:45 |
| Do you use ternary operators in your code? | NotQuiteFree | Programming | 14 | 07-04-2004 11:21 |
| How about a Drivers/Operators page and a Human Players page | Anthony S. | CD Forum Support | 4 | 02-06-2001 22:47 |