case useing range
-
Is it possible to assign a range to a case statement? If not, is there a different way to accomplish the same thing? For example:
Switch (int x) { Case 0 to 5: Case 6 to 10: Case 11 to 15: Default: }
Thanks!David Wilkes
-
Is it possible to assign a range to a case statement? If not, is there a different way to accomplish the same thing? For example:
Switch (int x) { Case 0 to 5: Case 6 to 10: Case 11 to 15: Default: }
Thanks!David Wilkes
-
Is it possible to assign a range to a case statement? If not, is there a different way to accomplish the same thing? For example:
Switch (int x) { Case 0 to 5: Case 6 to 10: Case 11 to 15: Default: }
Thanks!David Wilkes
You can accomplish the same using this,
Switch (int x) { Case 0: Case 1: Case 2: Case 3: Case 4: Case 5: //Do processing here. break; ... Default: }
-
You can accomplish the same using this,
Switch (int x) { Case 0: Case 1: Case 2: Case 3: Case 4: Case 5: //Do processing here. break; ... Default: }
Thats good thinking, I should have remembered that since I have used similar structures in the past. However, I only see that as workable within a limited range. I am looking at ranges like 0-512, 513-1024, 1025-2048... Sadly there is not a consistent step size, or I would simply divide the value by the step size. Thanks for the response! This is a helpful & responsive group!
David Wilkes