On Monday, 9 December 2013 at 13:57:04 UTC, qznc wrote:
  int x;
  if((x = some_long_expression.here) > 0) {
    writefln("x is %s", x);
  }

The bad news is that this means type inference cannot be used here (no "auto") and the variables is declared in a wider scope than just the if-body.

Ok then write:

{
  auto x = some_long_expression.here;
  if (x > 0) {
    writefln("x is %s", x);
  }
}

Reply via email to