On 5/28/10, bearophile <bearophileh...@lycos.com> wrote: > in for arrays: > if (x in (1, 2, 3)) {}
If the uniform function call syntax starts up, you could (maybe) do something like this: import std.algorithm; import std.array; bool among(T)(T v, T[] arr...) { return ! (arr.find(v).empty); } if( x . among ( 1, 2, 3 ) ) { } This doesn't work right now because you can't do property syntax on ints, but this might work in the near future. It does work if you're looking for an array: "hello" . among ( "world", "hello", "whatever" ); // compiles and runs correctly right now I picked "among" here since it does what it means and isn't a reserved word like "in" right now. The name doesn't really matter though.