[Pas2js] A pascal version of the C ternary operator ( ? : )

Sven Barth pascaldragon at googlemail.com
Tue Dec 25 19:15:19 CET 2018


Am 25.12.2018 um 18:22 schrieb silvioprog:
> On Tue, Dec 25, 2018, 12:39 Sven Barth via Pas2js 
> <pas2js at lists.freepascal.org <mailto:pas2js at lists.freepascal.org> wrote:
>
>     Am 24.12.2018 um 22:24 schrieb silvioprog:
>>     On Mon, Dec 24, 2018 at 3:43 PM Sven Barth via Pas2js
>>     <pas2js at lists.freepascal.org
>>     <mailto:pas2js at lists.freepascal.org>> wrote:
>>
>>         Am 22.12.2018 um 23:11 schrieb silvioprog:
>>>         On Sat, Dec 22, 2018 at 10:32 AM warleyalex via Pas2js
>>>         <pas2js at lists.freepascal.org
>>>         <mailto:pas2js at lists.freepascal.org>> wrote:
>>>
>>>             if then else alternative feature ( ? : )
>>>
>>>             Amazing to see new fetures introduced to pas2js. I must
>>>             say that I do really
>>>             like this syntax.
>>>
>>>             ------- // pascal version // ------
>>>             var
>>>               msg: String;
>>>             begin
>>>               msg := "There are " + IntToStr(n) + " user" + if (n>1)
>>>             then "s" else "";
>>>             end;
>>>             ----------------------------------------
>>>
>>>
>>>         It sounds very good and will be useful.
>>>
>>>         For the first time in history a language will make ternary
>>>         operators readable. :-)
>>>
>>         That statement is incorrect as Oxygen already provides an
>>         if-expression like that.
>>
>>         Regards,
>>         Sven
>>
>>
>>     Some link for the mere mortals? :-)
>>
>     Here:
>     https://www.elementscompiler.com/elements/oxygene/language.aspx#grabbag
>     Search for ""if", "case" and "for" loop expressions".
>
>     Regards,
>     Sven
>
>
> O took a look at it, very interesting features, specially the "for" 
> possibilities. Also, I saw something like async/await, I didn't know 
> that a language similar to Pascal provide such features. Thanks for 
> sharing!
Oxygene added some features that I wouldn't necessarily mind to add to 
FPC some time in the future. Though it would definitely be cherry picking...

Regards,
Sven
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/pas2js/attachments/20181225/4c477f6b/attachment-0001.html>


More information about the Pas2js mailing list