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

Jussi Lahtinen jussi.lahtinen at ...626...
Fri Jan 2 01:56:45 CET 2015


I think this is handled like function named Not:
If Not(True) Then

And this is what you are trying to do:
If Not (True) Then

Or just:
If Not True Then



Jussi


On Fri, Jan 2, 2015 at 2:38 AM, Lewis Balentine <lewis at ...3412...> wrote:

> My Apologies, I was trying to keep the message short and to the point:
>
> ' Gambas module file
> ' Project IfNot
>
> Public Sub Main()
>    ' The following line Prints "False"
>    If TestFunk() Then Print "True" Else Print "False"
>    ' The following line prints "False"
>    If TestFunk() = False Then Print "False" Else Print "True"
>    '*** The following line produces the error "unknown identifier: NOT" ***
>    'If Not(TestFunk()) Then Print "False" Else Print "True"
>    ' The following line prints "True"
>    If True Then Print "True" Else Print "False"
>    '*** The following line produces the error "unknown identifier: NOT" ***
>    'If Not(True) Then Print "False" Else Print "True"
>
> End
>
> Private Function TestFunk() As Boolean
>      Return False
> End
>
> ' [System]
> ' *** Gambas = 3.6.2 ***
> ' OperatingSystem = Linux
> ' Kernel = 3.13.0 - 24 - generic
> ' Architecture = x86_64
> ' Distribution = Linux Mint 17 Qiana
> ' Desktop = MATE
> ' Theme = QGtk
> ' Language = en_US.UTF - 8
> ' Memory = 15994 M
> ' [Libraries]
> ' Cairo = libcairo.so.2.11301.0
> ' Curl = libcurl.so.4.3.0
> ' DBus = libdbus - 1. so.3.7.6
> ' GStreamer = libgstreamer - 0.10.so.0.30.0
> ' GStreamer = libgstreamer - 1.0.so.0.204.0
> ' GTK + 3 = libgtk - 3. so.0.1000.8
> ' GTK += libgtk - x11 - 2.0.so.0.2400.23
> ' OpenGL = libGL.so.1.2.0
> ' Poppler = libpoppler.so.44.0.0
> ' Qt4 = libQtCore.so.4.8.6
> ' SDL = libSDL - 1.2.so.0.11.4
> '====================================
> ' [System]
> ' *** Gambas = 3.6.90 ***
> ' OperatingSystem = Linux
> ' Kernel = 3.13.0 - 24 - generic
> ' Architecture = x86_64
> ' Distribution = Linux Mint 17 Qiana
> ' Desktop = MATE
> ' Theme = QGtk
> ' Language = en_US.UTF - 8
> ' Memory = 3944 M
> ' [Libraries]
> ' Cairo = libcairo.so.2.11301.0
> ' Curl = libcurl.so.4.3.0
> ' DBus = libdbus - 1. so.3.7.6
> ' GStreamer = libgstreamer - 0.10.so.0.30.0
> ' GStreamer = libgstreamer - 1.0.so.0.204.0
> ' GTK + 3 = libgtk - 3. so.0.1000.8
> ' GTK += libgtk - x11 - 2.0.so.0.2400.23
> ' OpenGL = libGL.so.1.2.0
> ' Poppler = libpoppler.so.44.0.0
> ' Qt4 = libQtCore.so.4.8.6
> ' SDL = libSDL - 1.2.so.0.11.4
>
> cheers,
>
> Lewis
>
>
>
> On 01/01/2015 04:39 PM, Tobias Boege wrote:
> > On Fri, 02 Jan 2015, adamnt42 at ...626... wrote:
> >> On Thu, 1 Jan 2015 23:13:20 +0100
> >> Tobias Boege <taboege at ...626...> wrote:
> >>
> >>> 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
> >> Hey Tobi!
> >>
> >> Didn't we do this one a few weeks ago?
> >>
> >> The error is not the NOT it's the missing () ....
> >>
> >> b :-)
> > And I insist that it would be easier to spot if there was a whole
> concrete
> > (yet minimal) script to look at, not abstracting from important
> syntactical
> > details like parentheses or whether BooleanFunction above was actually a
> > Function returning a Boolean or an expression producing a Boolean. Well
> > whatever, see you next time, I guess :-)
> >
> > Regards,
> > Tobi
> >
>
>
>
> ------------------------------------------------------------------------------
> Dive into the World of Parallel Programming! The Go Parallel Website,
> sponsored by Intel and developed in partnership with Slashdot Media, is
> your
> hub for all things parallel software development, from weekly thought
> leadership blogs to news, videos, case studies, tutorials and more. Take a
> look and join the conversation now. http://goparallel.sourceforge.net
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
>



More information about the User mailing list