|
Forum Index : Microcontroller and PC projects : "variable already defined"?
| Author | Message | ||||
| Tinine Guru Joined: 30/03/2016 Location: United KingdomPosts: 1646 |
Not sure if the above message is verbatim because I'm away from my system. Executing my program and I decide to break out. This is in MM Edit. I want to use "chat" to run a function or a sub but I get the error shown in the subject. Pretty sure it sometimes works OK but naturally, not when I really need it. ![]() Have I messed up or am I missing something? Regards, Craig Edited 2020-07-10 03:45 by Tinine |
||||
| lizby Guru Joined: 17/05/2016 Location: United StatesPosts: 3472 |
This gives it; can it be something related? DOS MMBasic Ver 5.05.02 Copyright 2011-2019 Geoff Graham > i%=1 > i$=1 Error: I already declared > PicoMite, Armmite F4, SensorKits, MMBasic Hardware, Games, etc. on fruitoftheshed |
||||
| Tinine Guru Joined: 30/03/2016 Location: United KingdomPosts: 1646 |
Oh, I should have been more specific. SUB MySub(MyParam) Do Something End Sub In "Chat", I type "MySub 5" and I get the error that MyParam is already defined. Regards, Craig Edit: Oh it probably is declared, not defined. Edited 2020-07-10 05:31 by Tinine |
||||
| lizby Guru Joined: 17/05/2016 Location: United StatesPosts: 3472 |
Curious. In MMBasic DOS, this works for me: > list mysub(5) End Sub mysub(x) Print x End Sub > run 5 > mysub 3 3 > But with an undeclared variable: > mysub A [3] Sub mysub(x) Error: X already declared > Or with the wrong type: > mysub "9" Error: Incompatible type: "9" > Edited 2020-07-10 06:03 by lizby PicoMite, Armmite F4, SensorKits, MMBasic Hardware, Games, etc. on fruitoftheshed |
||||
| Tinine Guru Joined: 30/03/2016 Location: United KingdomPosts: 1646 |
I have been revisiting this and I can make it work if I ERASE the "already declared" variable in chat before calling the procedure. |
||||
| The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2025 |