Re: please need help .. with swith and conditional operator?
yeah i know that we show use what we understand .. but there's questions that request to solve it by a define way .. so that i'm asking for another way ..
Re: please need help .. with swith and conditional operator?
Yoinks, iamthwee, at least she is asking to learn...
This is an expression: x > y. It evaluates to an integral (aka ordinal) value (specifically, a bool), which is what the switch statement takes. So when you say switch (something) {
as long as something evaluates to an integral expression then the switch will work just fine.
Nobody uses switch for boolean expressions because it is faster and easier to read just to use an if. The if, btw, also takes an integral expression. If zero, it is understood as false. If non-zero, it is understood as true.
No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.