Saturday 15 February 2014

ios - if an expression returns true/false, why can't I use it in a case? -


I have already written it with / again, but it bothers me and hopefully someone educates me I can have the following switch statement:

  switch (right) {case [request.URL.absoluteStringEqualToString: secondMapUrl]: do not return; break; Case [request.URL.absoluteStringEqualToString: mapUrl]: [auto openMapViewController]; no return; Default: Yes return; }   

that fails with "expression integer is not a continuous expression" - but there is a right / wrong evaluation of those cases that you can use, that is The case is true: - Is there a way to make a switch statement work in this way?

The compiler needs to be able to compile the results, where the methods do not return constants (they Dynamic results are returning, which may or may not be).

"Switch" is not suitable in this situation.

and on the keyword " (correct) " (which is itself a constant and in some languages ​​there are some things that support the compiler ), I also think that is not valid. If you have a variable named " true " in fact, you should change it to a more sensitive value name.

No comments:

Post a Comment