[Gambas-user] What's happening with True and False string conversions?

John Anderson johna at starflightinc.com
Fri May 28 23:30:03 CEST 2021


An HTML attachment was scrubbed...
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20210528/c6b6a541/attachment-0001.htm>
-------------- next part --------------
' Gambas module file

Public Sub Main()

  Print True            'Prints "True" string
  Print False           'Prints "False" string
  Print True & False    'Prints "T" and nothing
  Print CStr(True)      'Prints 'T'
  Print CStr(False)     'Prints nothing
  Print Len(CStr(False)) 'Length of false string conversion is 0
  Print (1 = 1)          'Prints "True" - expression is true
  Print (1 = 0)          'Prints "False" - expression is false
  Print CStr((1 = 1))          'Prints "T" - expression is true
  Print CStr((1 = 0))          'Prints nothing - empty string - expression is false
  Print (1 = 1) & (1 = 1)          'Prints "TT" - both expressions are true
  Print CStr((1 = 1)) & CStr((1 = 0)) 'Prints "T" - one expression true, the other false

End
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Gambas3_TestBoolStr_Info.txt.tar.gz
Type: application/gzip
Size: 1392 bytes
Desc: not available
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20210528/c6b6a541/attachment-0002.gz>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Gambas_TestBoolStr.tar.gz
Type: application/gzip
Size: 12616 bytes
Desc: not available
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20210528/c6b6a541/attachment-0003.gz>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Screenshot-Gambas3 Prints Boolean Expressions.png
Type: image/png
Size: 79877 bytes
Desc: not available
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20210528/c6b6a541/attachment-0001.png>


More information about the User mailing list