[Gambas-user] Short-circuit evaluation question

Charlie Ogier charlie at cogier.com
Fri Jan 26 16:10:43 CET 2018


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 
> <mailto:bagonergi at gmail.com>>:
>
>     See the attached project
>
>     Regards
>     Gianluigi
>
>
>
>
> --------------------------------------------------
>
> 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/c285cc25/attachment.html>


More information about the User mailing list