Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 08:54 01 Aug 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 : Old Bug or New?

Author Message
vegipete

Guru

Joined: 29/01/2013
Location: Canada
Posts: 1132
Posted: 07:04pm 20 Dec 2015
Copy link to clipboard 
Print this post

I'm trying to pass a single bracket as a string to a function and am getting an error: (This is running on an 'MX470.)
> LIST
If TEST("(") Then
Print "Bracket"
Else
Print "Something else"
EndIf
End

Function TEST(S$) As INTEGER
If S$ = "(" Then
TEST = 1
Else
TEST = 0
EndIf
End Function
> RUN
[1] If TEST("(") Then
Error: Expected closing bracket
> ? MM.VER
4.07
>

Is this fixed in newer versions of the MM firmware? Or am I doing something rather wrong?

Note: if I change the "(" to a different character, such as "A", the program runs as expected.

Thanks.Edited by vegipete 2015-12-22
Visit Vegipete's *Mite Library for cool programs.
 
vegipete

Guru

Joined: 29/01/2013
Location: Canada
Posts: 1132
Posted: 07:08pm 20 Dec 2015
Copy link to clipboard 
Print this post

I see that ")" doesn't work either.
Visit Vegipete's *Mite Library for cool programs.
 
robert.rozee
Guru

Joined: 31/12/2012
Location: New Zealand
Posts: 2442
Posted: 08:06pm 20 Dec 2015
Copy link to clipboard 
Print this post

just tested your code using an MX170 running the latest 5.0 firmware and the observed behaviour is present.

some interesting variants:

[2] If TEST("tan(45") Then
Error: Expected closing bracket

but 'If TEST("tan(45)") Then' produces the output 'Something else'


cheers,
rob :-)
Edited by robert.rozee 2015-12-22
 
ajkw
Senior Member

Joined: 29/06/2011
Location: Australia
Posts: 290
Posted: 09:41pm 20 Dec 2015
Copy link to clipboard 
Print this post

This seems to work ok.

MM170 Ver 5
Cheers,
Anthony


a$ = "("
If TEST(a$) Then
Print "Bracket"
Else
Print "Something else"
EndIf
End

Function TEST(S$) As INTEGER
If S$ = "(" Then
TEST = 1
Else
TEST = 0
EndIf
End Function
 
MicroBlocks

Guru

Joined: 12/05/2012
Location: Thailand
Posts: 2209
Posted: 10:44pm 20 Dec 2015
Copy link to clipboard 
Print this post

ouch, that looks like a parser problem in the interpreter.

Microblocks. Build with logic.
 
Geoffg

Guru

Joined: 06/06/2011
Location: Australia
Posts: 3292
Posted: 11:35pm 20 Dec 2015
Copy link to clipboard 
Print this post

Yes, that does look like a bug and I can guess what is causing it. I will investigate and report back.

Geoff
Geoff Graham - http://geoffg.net
 
Geoffg

Guru

Joined: 06/06/2011
Location: Australia
Posts: 3292
Posted: 03:34am 21 Dec 2015
Copy link to clipboard 
Print this post

It is a bug and it will be fixed in the next release (due in mid January).

Geoff
Geoff Graham - http://geoffg.net
 
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