[Gambas-user] print does not output if the var is FALSE, how to override?
Tobias Boege
taboege at gmail.com
Thu Jun 28 15:13:53 CEST 2018
On Wed, 27 Jun 2018, PICCORO McKAY Lenz wrote:
> if my var are set to false and i do Print var outputs nothig..
>
Are you sure? I get
$ cat false.gbs3
#!/usr/bin/env gbs3
Public Sub Main()
Dim var As Boolean
Print var
End
$ ./false.gbs3
False
Print calls Str$() to convert values to strings and Str$(False) is the
string "False", it's not empty. You or your Print seems to call CStr()
for whatever reason which converts the Boolean False to the Null string,
as that is the only falsy string in Gambas.
Instead of Jussi's suggestion with IIf() you can also use Str$(),
if you really just want "True" or "False" to be printed and not some
other strings.
Regards,
Tobi
--
"There's an old saying: Don't change anything... ever!" -- Mr. Monk
More information about the User
mailing list