4

There is something like this on openScad?

list = [2, 3];

if(1 in list){
  echo("in");
}else{
  echo("not in");
}
/* or better: */
list = [2, 3];
isin = 1 in list? 100 : 0;
Leved Resu
  • 79
  • 2

1 Answers1

6

For this it's possible to use the built-in search() function and check if the result is empty:

list = [2, 3, 1];
isin = len(search(1, list)) > 0 ? 100 : 0;
echo(isin);
kintel
  • 405
  • 2
  • 4