[Gambas-user] IF Not (any boolean) then

Tobias Boege taboege at ...626...
Thu Jan 1 23:13:20 CET 2015


On Thu, 01 Jan 2015, Lewis Balentine wrote:
> If I use "NOT" in an "IF" statement with any boolean (function or value) 
> then I get an error. example:
> 
> If NOT (BooleanFuntion) then Do this
> unknown identifier: NOT
> 
> Am I mistaken in thinking that one should be able to use the NOT 
> operator in this manner ?
> 
> I can get around this by changing the syntax to. example:
> If BooleanFuntion = False then Do this
> 

Attached is a script which works over here. If you use Not in the same way,
there must be an error in your Gambas or the parts of your code which you
didn't show us. (The latter being a common outcome of not sending the whole
script/project ;-))

Regards,
Tobi

-- 
"There's an old saying: Don't change anything... ever!" -- Mr. Monk
-------------- next part --------------
#!/usr/bin/gbs3

Private Function OddSeconds() As Boolean
  Return CBool(Second(Now()) Mod 2)
End

Public Sub Main()
  If Not OddSeconds() Then Print "Even seconds!"
End


More information about the User mailing list