[18 May 2010] Boolean trouble
Posted: Sat Jun 13, 2020 5:32 pm
Note: This is an archived post that was originally sent to the Hollywood mailing list on Tue, 18 May 2010 19:06:17 +0300
Hello,
I have two files test.hws and test2.hws.
test.hws looks like this:
And test2.hws:
When I execute test.hws with Hollywood it works as expected. But when I include the files into my "bigger" program and try to execute it, Hollywood stops at line "If la = True" and gives me this error message: "Attempt to compare a number with a string!".
If I change the line to this
If la = "True"
Hollywood stops complaining about it.
There are several boolean variables in my "bigger" program and some of the If statements work with True and some with "True".
It looks to me that sometimes a statement like myvar = True sets myvar as "True" and not as True. Is there a way to make sure that a variable really gets a boolean value?
-- Janne janne.email-address-removed@nospam.com
Hello,
I have two files test.hws and test2.hws.
test.hws looks like this:
Code: Select all
myTable = { [ "a" ] = True }
@INCLUDE "test2.hws"
p_Testing ()
Code: Select all
Function p_Testing ()
Local la = myTable [ "a" ]
If la = True
DebugPrint ( "True" )
Else
DebugPrint ( "False" )
EndIf
EndFunction
If I change the line to this
If la = "True"
Hollywood stops complaining about it.
There are several boolean variables in my "bigger" program and some of the If statements work with True and some with "True".
It looks to me that sometimes a statement like myvar = True sets myvar as "True" and not as True. Is there a way to make sure that a variable really gets a boolean value?
-- Janne janne.email-address-removed@nospam.com