|
Forum Index : Microcontroller and PC projects : Programming Advice
| Author | Message | ||||
| NickMikhay Newbie Joined: 05/02/2026 Location: United StatesPosts: 11 |
Hello, I have a question as I am getting to learn a little programming, and don't have any formal experience. I am trying to create a rudimentary program in MMBASIC for DOS, and to move it to the MM2 in the future. The plan is to get a line input from the user and compare that string to a list of possible keywords in an array. That part is understandable. However, I would like to use that string after some string manipulation code, to branch to another part of the program, preferably a label, but can be a sub. In other words, use a string as an entry to a part of the program, which will end there, or jump back to the start if the user wishes. I thought this is what the eval(s$) function is for, and that I would pass "GOTO Keyword" eval("GOTO Keyword") 'Where Keyword is a variable obtained from user. Or, just plain Goto Keyword 'Where Keyword is a variable obtained from user at runtime. Is this possible to do so in BASIC. |
||||
| toml_12953 Guru Joined: 13/02/2015 Location: United StatesPosts: 670 |
Yes you can GOTO or GOSUB to a label but look at multiline IF-THEN-ELSE first INPUT "Command";c$ IF c$="THIS" THEN do this code ELSEIF c$="THAT" do some other code ELSEIF c$="THE OTHER" do some other code still ELSE finally, if the other choices don't fit, do this code END IF |
||||
| vegipete Guru Joined: 29/01/2013 Location: CanadaPosts: 1181 |
Look at the "CALL" command. (Maybe unavailable for the MM2.) Edited 2026-06-28 14:06 by vegipete Visit Vegipete's *Mite Library for cool programs. |
||||
| Martin H. Guru Joined: 04/06/2022 Location: GermanyPosts: 1462 |
Oh yes, that was another thing. Looks like that’s available on CMM2 too https://geoffg.net/Downloads/Maximite/Colour_Maximite_2_User_Manual.pdf Page 69 Edited 2026-06-28 16:02 by Martin H. 'no comment |
||||
| Volhout Guru Joined: 05/03/2018 Location: NetherlandsPosts: 5957 |
CMM2 and MM2 are 2 totally different platforms. The MM2 is more like a picomite with version 5.5 MMbasic, less memory an 30% of the speed. Volhout PicomiteVGA PETSCII ROBOTS |
||||
| The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2026 |