[fpc-devel] new features and facilities

Carlo Kok ck at carlo-kok.com
Thu Oct 8 19:46:23 CEST 2015



Op 2015-10-08 om 19:25 schreef Dmitry Boyarintsev:
> On Thu, Oct 8, 2015 at 12:54 PM, Sven Barth <pascaldragon at googlemail.com
> <mailto:pascaldragon at googlemail.com>> wrote:
>
>     I had the idea to implement inline-if as well. I think the syntax I
>     selected is derived from Oxygene, but it looks very Pascal and
>     shouldn't break anything:
>
>     left := if expr1 then expr2 else expr3;
>
>     Thereby expr1 returns Boolean and expr2 determines the type of the
>     whole inline-if, thus expr3 needs to be compatible to expr2.
>
> Does Oxygene allow something like this?
> left := if expr1 then begin exprN, left := exprK end else begin
> left:=left+3; exp3 end
>
> or is it only one expression at a time?
> left := if expr1 then if expr2 then expr5 else expr6 else expr7;

Only one expression at a time, since the 'result' of the expression in 
oxygene is the combined type of the true value and false value, false 
being optional defaulting to nil.



More information about the fpc-devel mailing list