Place to put your Basic demos and examples

Moderator: Mmiscool

User avatar
By lew247
#51344 Thank you Mmiscool I have corrected that error
However
it STILL fails on this line IF B$ = "*" THEN
Syntax error in if command

I've checked the manual and I cannot see what could possibly be wrong with that statement
I'm tearing my head out because it's probably something miniscule but I can't figure it out

I did try IF B$ = * THEN but it still fails with the same error
User avatar
By lew247
#51346 The error is definitely with the IF THEN command
I tried this simple program
Code: Select allA = 1
IF A = "1" THEN
SERIALPRINTLN A


The error was once again the IF THEN command
Syntax error in if command
Halted at line 2


I tried it with A and with A$ and with 1 and "1" and none of it made any difference, neither did using LET A = 1
User avatar
By Mmiscool
#51347 Use a double == sign for comparing strings and a single for numbers.
User avatar
By lew247
#51349 I really hate to say this as it seems like I'm not even trying, but I am, I'm trying every variation I can think of
the double = doesn't work either

Try this
LET A = 1
IF A$ == "1" THEN
SERIALPRINTLN A


It will fail with this error
Syntax error in if command
Halted at line 2

It fails with the same error if I just use A instead of A$ or if I use 1 instead of "1"
I even tried = = as well as ==