<div dir="ltr"><div dir="ltr"><div dir="ltr">On Sat, Dec 22, 2018 at 10:32 AM warleyalex via Pas2js <<a href="mailto:pas2js@lists.freepascal.org">pas2js@lists.freepascal.org</a>> wrote:<br></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">if then else alternative feature ( ? : )<br><br>
Amazing to see new fetures introduced to pas2js. I must say that I do really<br>
like this syntax.<br>
<br>
------- // pascal version // ------<br>
var<br>
msg: String;<br>
begin<br>
msg := "There are " + IntToStr(n) + " user" + if (n>1) then "s" else "";<br>
end;<br>
----------------------------------------<br></blockquote><div><br></div><div>It sounds very good and will be useful.</div><div><br></div><div>For the first time in history a language will make ternary operators readable. :-)<br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
This can allow to eliminate the need for some intermediate variables and<br>
repetitions.<br>
This is a pascal version of the C ternary operator ( ? : )<br>
<br>
//--- JS output //-------------------------------------------------- <br>
var msg = "";<br>
msg = "There are "+n.toString()+" user"+((n>1)?"s":"");<br>
---------------------------------------------------------------------</blockquote><div><br></div></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div>Silvio Clécio</div></div></div></div></div>