[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: difference between


Ps. Oops. Sorry that example code is not actually valid code.
Seems testing "If Not S1 Begins sSomething" will give "error expected
Boolean got String instead"

But the lesson is still there I think.

I HAVE had times where Not was being used in the wrong place in a
conditional statement in a similar way giving me wrong results, I just
picked String/Begins as a bad example I guess. It gives the correct message
but technically with invalid code.

BruceS

On Sat, 10 Oct 2026, 10:25 Bruce Steers, <bsteers4@xxxxxxxxx> wrote:

> I can possibly explain better with String and Begins...
> Consider this .
>
> s1 = ""
> s2 = "something"
>
> Now this
> If Not s1 Then Print "s1 has no text"
> If Not s2 Then Print "s2 has no text"
>
> Now look at this
> If Not s2 Begins "s" Then
>
> That is wrong and will return True only if s2 has no text, the 'Begins
> "s"' part is not tested at all.
> It is just the same as writing...
> If Not s2
>
> But this...
> If s2 Not Begins "s" Then
>
> That's correct Not is now testing if s2 Begins "s" and not just if s2 is
> Null
>
> Hope that is clearer for you 😎
> BruceS
>
> On Sat, 10 Oct 2026, 09:42 Bruce Steers, <bsteers4@xxxxxxxxx> wrote:
>
>> Not is only testing PictureBoxQRCode.Image, it ignores the = Null part
>>
>> Like
>> if Picturebox.Image Then
>> Or
>> if Not Picturebox.Image Then
>>
>> You must do like this...
>>  If PictureBoxQRCode.Image <> Null Then
>>
>> It just..
>>  If Not PictureBoxQRCode.Image Then
>>
>> BruceS
>>
>>
>> On Sat, 10 Oct 2026, 07:43 valaquarus, <valaquarus@xxxxxxxxx> wrote:
>>
>>> Hello,
>>> what are the differences between these two assertions, because they
>>> don't act exactly the same way :
>>>
>>> - If Not PictureBoxQRCode.Image = Null Then...
>>> - If Not IsNull(PictureBoxQRCode.Image) Then...
>>>
>>>
>>> [System]
>>> Gambas=3.22.99 2992226 (master)
>>> OperatingSystem=Linux
>>> Distribution=Manjaro Linux
>>> Kernel=7.2.3-2-MANJARO
>>> Architecture=x86_64
>>> Cores=4
>>> Memory=5713M
>>> Language=fr_FR.UTF-8
>>> Platform=x11
>>> Desktop=KDE
>>> DesktopResolution=96
>>> DesktopScale=9
>>> WidgetTheme=breeze
>>> Font=Adwaita Mono,12
>>> DarkTheme=False
>>> [Programs]
>>> appimage-builder=appimage-builder: 1.1.1.dev32+g2709a3b
>>> clang=clang version 22.1.8
>>> dpkg=Programme « dpkg » de gestion de paquets Debian version
>>> 1.23.7-dirty (amd64).
>>> gcc=gcc (GCC) 16.2.1 20260810
>>> git=git version 2.55.0
>>> msgmerge=msgmerge (GNU gettext-tools) 1.0
>>> pngquant=3.0.3
>>> rpmbuild=RPM version 6.0.1
>>> trans=Translate Shell 0.9.7.1-git:dc67af4
>>> [Libraries]
>>> Cairo=libcairo.so.2.11804.4
>>> Curl=libcurl.so.4.8.0
>>> DBus=libdbus-1.so.3.38.3
>>> GDK2=libgdk-x11-2.0.so.0.2400.33
>>> GDK3=libgdk-3.so.0.2420.32
>>> GStreamer=libgstreamer-1.0.so.0.2806.0
>>> GTK+2=libgtk-x11-2.0.so.0.2400.33
>>> GTK+3=libgtk-3.so.0.2420.32
>>> OpenGL=libGL.so.1.7.0
>>> Poppler=libpoppler.so.163.0.0
>>> QT5=libQt5Core.so.5.15.19
>>> QT6=libQt6Core.so.6.11.2
>>> RSvg=librsvg-2.so.2.62.3
>>> SDL=libSDL2-2.0.so.0.3200.72
>>> SQLite3=libsqlite3.so.3.53.4
>>> [Environment]
>>> DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus
>>> DEBUGINFOD_URLS=https://debuginfod.archlinux.org
>>> DESKTOP_SESSION=/usr/share/xsessions/plasmax11.desktop
>>> DISPLAY=:0
>>> DOCKER_HOST=unix:///run/user/1000/podman/podman.sock
>>> GB_GUI=gb.gtk3
>>>
>>> GTK2_RC_FILES=/etc/gtk-2.0/gtkrc:<home>/.gtkrc-2.0:<home>/.config/gtkrc-2.0
>>> GTK_MODULES=canberra-gtk-module
>>> GTK_RC_FILES=/etc/gtk/gtkrc:<home>/.gtkrc:<home>/.config/gtkrc
>>> HOME=<home>
>>> ICEAUTHORITY=/run/user/1000/iceauth_IlqFFb
>>> INVOCATION_ID=41b15739ce1c46eb9a1566475fbf9362
>>> JOURNAL_STREAM=10:13404
>>> KDE_APPLICATIONS_AS_SCOPE=1
>>> KDE_FULL_SESSION=true
>>> KDE_SESSION_UID=1000
>>> KDE_SESSION_VERSION=6
>>> LANG=fr_FR.UTF-8
>>> LANGUAGE=fr_FR.UTF-8
>>> LOGNAME=<user>
>>> MAIL=/var/spool/mail/<user>
>>> MANAGERPID=826
>>> MANAGERPIDFDID=8436
>>>
>>> MEMORY_PRESSURE_WATCH=/sys/fs/cgroup/user.slice/user-1000.slice/user@1000.service
>>> /session.slice/plasma-plasmashell.service/memory.pressure
>>> MEMORY_PRESSURE_WRITE=c29tZSAyMDAwMDAgMjAwMDAwMAA=
>>> MOTD_SHOWN=pam
>>> OLDPWD=<home>
>>> PAM_KWALLET5_LOGIN=/run/user/1000/kwallet5.socket
>>>
>>> PATH=<home>/.local/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/var/lib/flatpak/exports/bin:/usr/lib/jvm/default/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl:/usr/lib/rustup/bin
>>> PWD=<home>
>>> QT_LINUX_ACCESSIBILITY_ALWAYS_ON=1
>>> QT_LOGGING_RULES=*.debug=false
>>> QT_QPA_PLATFORM=xcb
>>>
>>> QT_SCREEN_SCALE_FACTORS=LVDS-1=1;VGA-1=1;HDMI-1=1;DP-1=1;HDMI-2=1;HDMI-3=1;DP-2=1;DP-3=1;
>>> QT_WAYLAND_RECONNECT=1
>>>
>>> SESSION_MANAGER=local/<hostname>:@/tmp/.ICE-unix/969,unix/<hostname>:/tmp/.ICE-unix/969
>>> SHELL=/usr/bin/zsh
>>> SYSTEMD_EXEC_PID=981
>>> TZ=:/etc/localtime
>>> USER=<user>
>>>
>>> VSSCRIPT_PATH=/usr/lib/python3.14/site-packages/vapoursynth/libvsscript.so
>>> XAUTHORITY=/run/user/1000/xauth_cjAxZJ
>>>
>>> XDG_CONFIG_DIRS=<home>/.config/kdedefaults:/etc/xdg:/usr/share/manjaro-kde-settings/xdg
>>> XDG_CURRENT_DESKTOP=KDE
>>>
>>> XDG_DATA_DIRS=<home>/.local/share/flatpak/exports/share:/var/lib/flatpak/exports/share:/usr/local/share:/usr/share
>>> XDG_MENU_PREFIX=plasma-
>>> XDG_RUNTIME_DIR=/run/user/1000
>>> XDG_SEAT=seat0
>>> XDG_SEAT_PATH=/org/freedesktop/DisplayManager/Seat0
>>> XDG_SESSION_CLASS=user
>>> XDG_SESSION_DESKTOP=KDE
>>> XDG_SESSION_ID=2
>>> XDG_SESSION_PATH=/org/freedesktop/DisplayManager/Session1
>>> XDG_SESSION_TYPE=x11
>>> XDG_VTNR=2
>>>
>>>
>>> Good day to all of you
>>>
>>> --
>>>
>>> valaquarus <valaquarus@xxxxxxxxx>
>>>
>>

References:
difference betweenvalaquarus <valaquarus@xxxxxxxxx>
Re: difference betweenBruce Steers <bsteers4@xxxxxxxxx>
Re: difference betweenBruce Steers <bsteers4@xxxxxxxxx>