[Pas2js] The operator ??
silvioprog
silvioprog at gmail.com
Sat Dec 22 23:08:04 CET 2018
On Sat, Dec 22, 2018 at 10:38 AM warleyalex via Pas2js <
pas2js at lists.freepascal.org> wrote:
> So for example let’s consider the nullable float value x in the following
> example;
> If it is specified it will print its value, otherwise it will print "‘1".
>
> ---// the special operator ?? //----------------------
> var
> x: JSValue;
> begin
> console.log(x ?? 1);
> end;
> ------------------------------
>
> //------- JS output : The operator ?? translates to something like:
> //--------
> var x;
> console.log(x||1);
Maybe by overloading the "or" operator as soon as it is supported? :-)
--
Silvio Clécio
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/pas2js/attachments/20181222/705356b4/attachment.html>
More information about the Pas2js
mailing list