Ternary conditional if/else


#1

Set the canDrive variable equal to the ternary expression: (fuelLevel > 0) ? 'Y' : 'N';


#2

Assuming canDrive is a char and fuelLevel is some kind of number,

canDrive = (fuelLevel > 0) ? 'Y' : 'N';

will work.