I canβt find a direct answer yes or no to this in my search. On Android, is there a way to use a conditional statement in case-switch? For example, if age is an int value:
switch (age){ case (>79): // Do this stuff break; case (>50): // Do this other stuff break; etc, etc
I tried several ways to encode this (completely shooting in the dark) and come up with compiler errors, and I also tried the nested IF statement, but it does not support breaking, so the logic breaks and it also ends up executing ELSE code in nesting. I feel that the switch is my best bet, but I can't find an example of the correct syntax for what I'm trying to do! Any help would be greatly appreciated. All the examples that I find just use a patch case for a few things, for example, if it is 1, do it if it does 2, but without making 100 cases to check the age, I'm not sure how else this works.
source share