<p>Am 02.02.2016 11:27 schrieb "Michael Van Canneyt" <<a href="mailto:michael@freepascal.org">michael@freepascal.org</a>>:<br>
><br>
><br>
><br>
> On Tue, 2 Feb 2016, Serguei TARASSOV wrote:<br>
><br>
>> On 02/02/2016 10:54, <a href="mailto:fpc-pascal-request@lists.freepascal.org">fpc-pascal-request@lists.freepascal.org</a> wrote:<br>
>><br>
>>> On Tue, 2 Feb 2016, Michael Van Canneyt wrote<br>
>>>><br>
>>>><br>
>>>> On Tue, 2 Feb 2016, Serguei TARASSOV wrote: > No, the second is always better because safer.<br>
>>>> ><br>
>>>> >x := iif (Obj = nil, 0, Obj.Value);<br>
>>>> >This will raise access violation as a normal function or you depend on<br>
>>>> >compiler implementation for this special case. And you should remember an<br>
>>>> >additional special case of function.<br>
>>>> ><br>
>>>> >x := iif Obj = nil then 0 else Obj.Value;<br>
>>>> >Doesn't raise AV because it's a statement, not function.<br>
>>><br>
>>> It is not a statement, it is an expression.<br>
>><br>
>> ???<br>
>> iif is a new statement "inline if".<br>
>> It contains other statements "then" "else"<br>
>> It returns a value like an assignment statement ":=" in Pascal or "return" in C-like languages.<br>
>> It may be used without assignment:<br>
>><br>
>> {$IFDEF DEBUG}<br>
>> x :=<br>
>> {$ENDIF}<br>
>> iif Obj = nil then 0 else Obj.DoSomethingAndReturnValue;<br>
><br>
><br>
> I doubt this is what Sven implemented/will implement. The assignment will always be needed.<br>
> But Sven will have to comment on that.</p>
<p>Indeed.</p>
<p>Regards,<br>
Sven</p>