Dňa 5.2.2016 o 11:50 Lukasz Sokol napísal(a):
On 05/02/16 10:35, Andreas wrote:
On Fri 05/02/2016 07:49, Lukasz Sokol wrote:
That it's C, not Pascal ;) and, um. sorry I do not have a c spec on hand,
does it really work that way in C - only evaluates truevalue or falsevalue not
both?
I wrote another one in another email, maybe actually having new keyword or 2 is
ok ?
and require it to be an assignment, like
x := ( condition; whentrue:=true_value; whenfalse:=false_value);
so syntactic sugar but not abusing function calls, but an assignment instead.
Well then how about: x *:=* *when* condition true_condition *otherwise*
false_condition;
How this is pascalish.
Smells, like perl or python... I almost wrote the 'when version' but... ;)
without clear indication that a value is returned, it's like a statement...
Any other imaginative way to indicate that a construct returns a value, other
than using braces...?
as 'just braces' will confuse people using _() a lot.
(side note :
x := (when condition use truevalue otherwise falsevalue);
It look s very strange to me.
Why not just reuse C:
x := condition ? truevalue : falsevalue ;
As stated before.
May be only for {$COPERATORS ON}
(So it will not influence Pascal language, but for those who want use
it, can enable this syntax using switch)
-Laco.
_______________________________________________
fpc-pascal maillist - fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal