Home
JAQForum Ver 20.06
Log In or Join  
Active Topics
Local Time 01:02 21 Apr 2024 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 : Error in line 11: A sub/fun has the same name: FUNC_B

Author Message
LeoNicolas

Guru

Joined: 07/10/2020
Location: Canada
Posts: 441
Posted: 05:25pm 08 May 2022
Copy link to clipboard 
Print this post

What am I doing wrong?

MMBasic for Windows, version 5.07.03b9


func_a(0)

function func_a(t)
   ? "func_a(" + str$(t) + ")"
   func_b(10)
   if t=0 then func_a=func_a(1)
end function

function func_b(v)
   ? "func_b()"
   func_b=v ' <===== Line 11
end function
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 5707
Posted: 05:42pm 08 May 2022
Copy link to clipboard 
Print this post

Isn't it seeing func_b as a variable in that line? It's already used the name func_b() as a function. Can you do that?
Mick

Zilog Inside! nascom.info for Nascom & Gemini
Preliminary MMBasic docs & my PCB designs
 
LeoNicolas

Guru

Joined: 07/10/2020
Location: Canada
Posts: 441
Posted: 05:57pm 08 May 2022
Copy link to clipboard 
Print this post

Hum, option explicit has fixed the issue
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 8570
Posted: 06:00pm 08 May 2022
Copy link to clipboard 
Print this post

You have a function called recursively which MMbasic can't do. The MM2 fails on this as well albeit with a different error
 
Print this page


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

© JAQ Software 2024