WurstScript icon indicating copy to clipboard operation
WurstScript copied to clipboard

enhance switch

Open PhoenixZeng opened this issue 5 years ago • 1 comments

like kotlin

switch foo
    case 1
        //todo exist like now 
    case 2  ->  //todo but in one line like closure 
    in 3..5
        //todo when foo >= 3 and foo <= 5
    not in 1..10
        //todo when foo < 1 or foo > 10
    case 6|8|80
        // todo when foo equals 6 or 8 or 80
    if this mod 2 == 0
        // todo when foo mod 2 == 0
    or// 'or' or 'else'
        //like default but short

PhoenixZeng avatar May 29 '19 18:05 PhoenixZeng

only support integer is enoughed because it use with object-type-id usually
of course some features can support other type like string and enum

PhoenixZeng avatar May 29 '19 19:05 PhoenixZeng