[Gambas-user] Short-circuit evaluation question

Gianluigi bagonergi at gmail.com
Fri Jan 26 16:57:59 CET 2018


Hi Charlie,
apologize me for the project and the question, all very confusing.

The question was on the short circuit.
The NULL array is intended to demonstrate that short cirquitation does not
work in the second IF block.
I think it's due to the fact that the second IF starts with NOT.
See the new attached project
Thank you very much for your reply


Greetings
Gianluigi

2018-01-26 16:10 GMT+01:00 Charlie Ogier <charlie at cogier.com>:

> Hi Gianluigi,
>
> You need to add the 'New' word, twice.
>
> Regards,
>
> Charlie
>
> *Public Sub Main()*
>
> *  Dim ss As New String[]  ''Requires 'New'*
> *  ss = test()*
> *  If IsNull(ss) Then*
> *    Print "FOO"*
> *  Endif*
>
> *  If IsNull(ss) Or If ss.Count = 0 Then Print "ss.Count = 0 is True"*
> *  If Not IsNull(ss) Or If ss.Count > 0 Then Print "Not IsNull(ss) is
> True"*
>
> *End*
>
>
> *'________________________________________ **Private Function test() As
> String[]*
>
> *  Dim ss As New String[]  ''Requires 'New'*
> *  Return ss*
>
> *End*
>
>
> On 26/01/18 12:24, Gianluigi wrote:
>
> Sorry, too many useless things. ;-D
>   Dim ss as String[]
> Because this works:
>   If IsNull(ss) Or If ss.Count = 0 Then Return
> Because this does not work:
>   If Not IsNull(ss) Or If ss.Count > 0 Then
>     '...
>   Endif
>
> Regards
> Gianluigi
>
> 2018-01-26 12:24 GMT+01:00 Gianluigi <bagonergi at gmail.com>:
>
>> See the attached project
>>
>> Regards
>> Gianluigi
>>
>
>
>
> --------------------------------------------------
>
> This is the Gambas Mailing Listhttps://lists.gambas-basic.org/listinfo/user
>
> Hosted by https://www.hostsharing.net
>
>
>
>
> --------------------------------------------------
>
> This is the Gambas Mailing List
> https://lists.gambas-basic.org/listinfo/user
>
> Hosted by https://www.hostsharing.net
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20180126/ae845492/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ShotCirquit-0.0.1.tar.gz
Type: application/x-gzip
Size: 11174 bytes
Desc: not available
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20180126/ae845492/attachment-0001.bin>


More information about the User mailing list