Looking for marco support "in" in an if statement like python?

looking for marco support “in” in an if statement?

python code support

 if    shape in ['TRIANGLE', 'PENTAGON'] :
      xxxx

and haxe code add some meta like @ifin?

@ifin

function test(){

var xxx="c";

if( xxx in ["a","b"]){

  }else{

   }
}
}

Can Array.contains() do what you want ?

if ( ["a", "b"].contains(xxx) ) {
  trace("yes");
}

[Edit] or maybe you want to be able to use the python code as-is with no modification ?

1 Like