This else if not working
Hello all,
I have to convert y and z to a and b. Same with the uppercase values. My code doesn't seem to be working:
1 2 3 4
|
else if(((value == 'y') &&(value == 'z'))||((value == 'Y')&&(value == 'Z')))
{
value -= 24;
}
|
Am I doing something wrong here.
Thanks
V
value can't be both 'y' and 'z' at the same time. The condition is never met.
Athar
Could I keep the same condition with changes or would I need to separate the conditions?
Thanks
Just make the operators all ||.
1 2 3 4
|
else if(value == 'y' || value == 'z' || value == 'Y' || value == 'Z')
{
value -= 24;
}
|
Only works because Y and A and Z and B are the same distance apart. Really not the best way to do this.
Last edited on
Topic archived. No new replies allowed.