IF statement error?

Previous topic - Next topic

bigsofty

This does not work...

Code (glbasic) Select
a$ = "a"
IF a$<>"" THEN DEBUG "a$ not blank"


There are ways around this, checking for the length of the string, ELSEIF etc... but there all workarounds. This could be very confusing for a GLB beginner.

Request: It would be great if good old logical NOT was supported in the IF statements.
Cheers,

Ian.

"It is practically impossible to teach good programming style to students that have had prior exposure to BASIC.  As potential programmers, they are mentally mutilated beyond hope of regeneration."
(E. W. Dijkstra)

Moru

That code works fine for me with version 7.078. What version are you running?

bigsofty

Thanks Moru, weird problem.

Now I am confused, if I run the above code as a new project, it runs as expected.

If I insert the code into my own project, it does not work?

I'll do a little experimenting to see if I can see if I highlight the problem better...  :doubt:
Cheers,

Ian.

"It is practically impossible to teach good programming style to students that have had prior exposure to BASIC.  As potential programmers, they are mentally mutilated beyond hope of regeneration."
(E. W. Dijkstra)

bigsofty



Pah, previous compile run created a dead process in memory... killed it off an it ran fine.

Thanks for your help Moru ;)

P.S. I would still like to be able to use NOT in an IF statement though :P
Cheers,

Ian.

"It is practically impossible to teach good programming style to students that have had prior exposure to BASIC.  As potential programmers, they are mentally mutilated beyond hope of regeneration."
(E. W. Dijkstra)

Moru

Try if bNOT is doing what you want, I'm not totally sure it will work as you expect it :-)

MrTAToad

BNOT is for binary stuff, not logical...

Moru

yes, I was expecting that since true in GLBasic is 1, not -1. So it's not working.