Why is there no or or and ?
F i L
witte2008 at gmail.com
Thu Feb 16 21:47:20 PST 2012
I would use them over '||' and '&&' for the reasons bearophile
gave. Highlighted as keywords, they're easily set appart, easier
to type, and more distinguished... then again if I had my way I'd
remove the '('/')' brackets, ending marks, and auto keyword;
switched the definition name-type placement and change
if/else/return/contract syntax...
foo( a, b: float ): int
{
contract in
{
assert( a != 0 and b != 0 )
}
result: = a + b
case a >= b { ret result }
else b > a { ret a }
ret 0
}
writeLine: alias writeln
main()
{
a, b: float = 10.2, 5.0
writeLine( foo( a, b ) )
}
Tell me that's not beautiful code! :D
More information about the Digitalmars-d
mailing list