Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 17:42 12 Jul 2025 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : MMBasic: unhelpful syntax issue with CASE IS

Author Message
thwill

Guru

Joined: 16/09/2019
Location: United Kingdom
Posts: 4302
Posted: 07:25pm 20 Nov 2022
Copy link to clipboard 
Print this post

Hi Peter & Geoff,

Reproduced with CMM2, PicoMite (, MMB4L) and presumably also present in MMB4W:

> list "case_is.bas"
Option Explicit On
Dim i = 2
Select Case i
 Case Is>=0
   Print "Hello"
 Case Else
   Print "Goodbye"
End Select

> run "case_is.bas"
Error in line 4: IS is not declared
>


Add a space after the IS keyword and it works.

It's worse if you don't have OPTION EXPLICIT ON, because then this will unexpectedly print "Goodbye" !!!

Best wishes,

Tom
Edited 2022-11-21 05:35 by thwill
MMBasic for Linux, Game*Mite, CMM2 Welcome Tape, Creaky old text adventures
 
phil99

Guru

Joined: 11/02/2018
Location: Australia
Posts: 2611
Posted: 09:48pm 20 Nov 2022
Copy link to clipboard 
Print this post

Try:-
...
Select Case i
Case >=0
...

No IS in PicoMite manual

> for i=-2 to 2:Select Case i :Case >=0:Print "Hello":Case Else:Print "Goodbye":End Select :next
Goodbye
Goodbye
Hello
Hello
Hello
>
Edit
Need new glasses, IS is there.

This is interesting, without Option Explicit IS becomes a variable ANDed with i.

> for i=-2 to 2:Select Case i :Case is>=0:Print "Hello":Case Else:Print "Goodbye":End Select :next
Goodbye
Goodbye
Goodbye
Hello
Goodbye
> ? is
0
>
Edited 2022-11-21 08:18 by phil99
 
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 6269
Posted: 10:12pm 20 Nov 2022
Copy link to clipboard 
Print this post

IS is optional in most (all?) MMBasic versions.

Jim
VK7JH
MMedit
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10240
Posted: 10:25pm 20 Nov 2022
Copy link to clipboard 
Print this post

Known issue - no fix
 
thwill

Guru

Joined: 16/09/2019
Location: United Kingdom
Posts: 4302
Posted: 11:27pm 20 Nov 2022
Copy link to clipboard 
Print this post

Thanks for the pointers folks, especially to the fact that the inclusion of the IS keyword is unnecessary.

Best wishes,

Tom
MMBasic for Linux, Game*Mite, CMM2 Welcome Tape, Creaky old text adventures
 
Print this page


To reply to this topic, you need to log in.

The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2025