Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

Zephir error boolean switch case

Hi, guys I have a trouble, im type the next case when i set a conditional in case for ex:

switch boolean { case 1: let y = "";// this ok break; case 4 || 3: //this crash other sentence... break; }

i could set in other case but i would repeat a lot of code, really this not a error is more like question, thanks



479
Accepted
answer

Hi,

This achieves what you want.

var a = 1, b;
switch(a) {
    case 1:
        let b = 1;
    break;
    case 2:
    case 3:
        let b = 2;
    break;
}