Syntax error passing arrays to Sub

Recurrent H/W and software problems
Post Reply
EasyRider
Posts: 27
Joined: Sat Jun 05, 2021 1:27 am
Has thanked: 7 times
Been thanked: 2 times

Syntax error passing arrays to Sub

Post by EasyRider »

Newbie just going through the documentation and running some examples.
Using ESP32 and latest 1.43.4 firmware.

In example copied from the docs, of passing arrays to Sub I am getting a syntax error and I can't see why.

Syntax error is in line 13 "pass_array alpha(), beta$()" , there is actually an error in documentation where Pass has capital P.
Anyway with corrected Capital p it is still throwing a Syntax error.

Code: [Local Link Removed for Guests]

SUB pass_array(f(), c$())
  Dim myArray(10)
  myArray(0) = 456 
  Print f(0), c$(0), myArray(0)
  f(1) = 123
  c$(1) = "myText"
END SUB

Dim alpha(10)
Dim beta$(10)
alpha(0) = 456
beta$(0) = "testme"
pass_array alpha(), beta$()
Print alpha(1), beta$(1)
EasyRider
Posts: 27
Joined: Sat Jun 05, 2021 1:27 am
Has thanked: 7 times
Been thanked: 2 times

Re: Syntax error passing arrays to Sub

Post by EasyRider »

Tried minimal program using single array numeric argument and when calling sub in line 8 it still throws Syntax error?
Could it be that passing arrays to sub is not working in this ESP32 firmware or a bug or documentation?

Code: [Local Link Removed for Guests]


SUB p(f())
Print f(0)
END SUB

Dim a(10)
a(0) = 4
p a()

EasyRider
Posts: 27
Joined: Sat Jun 05, 2021 1:27 am
Has thanked: 7 times
Been thanked: 2 times

Re: Syntax error passing arrays to Sub

Post by EasyRider »

Same problem in newest 1.44.2 firmware on ESP32
User avatar
cicciocb
Site Admin
Posts: 1889
Joined: Mon Feb 03, 2020 1:15 pm
Location: Toulouse
Has thanked: 405 times
Been thanked: 1260 times
Contact:

Re: Syntax error passing arrays to Sub

Post by cicciocb »

[Local Link Removed for Guests] wrote: [Local Link Removed for Guests]Fri Apr 29, 2022 10:51 am Same problem in newest 1.44.2 firmware on ESP32
Thanks, it is probably a regression to be fixed
User avatar
cicciocb
Site Admin
Posts: 1889
Joined: Mon Feb 03, 2020 1:15 pm
Location: Toulouse
Has thanked: 405 times
Been thanked: 1260 times
Contact:

Re: Syntax error passing arrays to Sub

Post by cicciocb »

OK, I found the problem.
Will be fixed in the next release
EasyRider
Posts: 27
Joined: Sat Jun 05, 2021 1:27 am
Has thanked: 7 times
Been thanked: 2 times

Re: Syntax error passing arrays to Sub

Post by EasyRider »

Pleased to report that it is working ok in firmware 1.50.8.
Post Reply