Help!Ternary conditional!


I don't know what's wrong with this code.I try many times.But it still inform me that "Did you set canDrive equal to the result of the ternary expression? You can use the example to help you." I'll appreciate it if you could help me to find the fault.Thanks a lot!!!
The following is my code:

int fuelLevel = 3;

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


You don't need the parenthesis around fuelLevel > 0, the rest of your code is correct, however.


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

try giving space.


Yes! The code was going on when I gave the space! Thanks for your help!


It still doesn't work. Anyway, thanks for your help!


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.