Daantjeeuh 10 Posted October 8, 2014 (edited) Is there a way to check for multiple values in a switch statement? Like this: switch (_unit) do { [indent]case unit1: case unit2: {[/indent] [indent][indent]// Code here[/indent] [/indent] [indent]};[/indent] [indent]case unit3: case unit4: {[/indent] [indent][indent]// Code here[/indent] [/indent] [indent]};[/indent] [indent]default {[/indent] [indent][indent]// Code here[/indent] [/indent] [indent]};[/indent] }; Edited October 8, 2014 by Daantjeeuh Share this post Link to post Share on other sites
Schatten 287 Posted October 8, 2014 switch (true) do { case (_unit in [unit1, unit2]): {...}; case ((_unit == unit3) or {_unit == unit4}): {...}; ... }; Share this post Link to post Share on other sites
Arctor 1 Posted October 8, 2014 Maybe something like this? switch true do { case (_unit == unit1 OR (unit == unit2)):{}; case (_unit == unit3 OR (unit == unit4)):{}; }; Share this post Link to post Share on other sites
Master85 1 Posted October 8, 2014 switch (_unit) do { case unit1; case unit2: { // Code here }; case unit3; case unit4: { // Code here }; default { // Code here }; }; Share this post Link to post Share on other sites
killzone_kid 1330 Posted October 8, 2014 https://community.bistudio.com/wiki/switch_do <= so many examples, so many ...:) Share this post Link to post Share on other sites