why ; ?
bearophile
bearophileHUGS at lycos.com
Thu May 8 08:24:37 PDT 2008
Janice Caron Wrote:
> Besides which, how would that work with statements like
> if (a == b) { ++i; ++j } else { --i; --j }
> If newlines were to take over the role of semicolons, then that would turn into
> if (a == b) { ++i
> ++j } else { --i
> --j }
You may want to take a look at Scala.
Your statement can be written like this, that is readable but needs many lines:
if (a == b) {
++i
++j
} else {
--i
--j
}
Or like this:
if (a == b) { ++i; ++j; } else { --i; --j; }
(Plus various other ways you can use today).
Both versions are okay, because ; becomes optional when it's at the end of the line. And the symbols for line continuations are part of this proposal, I presume.
If you want to remove the brackets too, you may end with:
if a == b:
++i
++j
else:
--i
--j
Bye,
bearophile
More information about the Digitalmars-d
mailing list