I have some simple programming questions for MMBasic on my PicoCalc. If I input a variable and then print that variable how do I force the answer to the next line. I read from the picomite user manual that a ; might be used. However, that doesn’t seem to work.
How do I write long lines in my programs and continue the script on the next line without getting a screen error or syntax error?
I tried an example program from the manual such as SQR(a * a + b * b) and I get an Unknown command error.
I am starting Geoff Grahams MMBasic Manual and am hopeful to get answers.
Any advice or assistance would be appreciated. I am having such fun with this little device.
Add a extra print in there;
Input "Type a number: "; x$
print x$
Sadly, the built in editor line lengths are limited to the screen. The best thing to do is edit the program outside of the Pico and then transfer it over using xmodem recieve.
You cannot do the math inside the SQR function like that, so do the math first.
x = (a * a + b * b)
SQR(x)
Thanks, inserting the extra print moved the inputs down to the next line. However, involking SQR still brought up an error code “unknown command”. I printed x. That math works. Am I still missing something?
Oops, my bad, it has been a while since I have had to use Basic for actual math. SQR(x) has to be saved somewhere. Try this, it worked for me.
x = (a * a + b * b)
y = SQR(x)
print y
You can’t just call a function. You have to do something with it.
SQR(x)
Won’t work. But:
print SQR(x)
or
y=SQR(x)
Works fine. That syntax for BASIC goes all the way back.
I have some simple programming questions for MMBasic on my PicoCalc. If I input a variable and then print that variable how do I force the answer to the next line.
If you are using the “official” PicoMite firmware provided by ClockworkPi then I believe there is a bug with newline handling in their customisations that shows itself with the INPUT command. I believe @adcockm fixed it in the firmware he posted here GitHub - madcock/PicoMiteAllVersions: This contains files to build MMbasic to run on both RP2040 and RP2350. My only concern is that I doubt ClockworkPi “broke” it by accident, so they were probably trying to workaround some other issue … time will tell.
I read from the picomite user manual that a ; might be used. However, that doesn’t seem to work.
You use a semi-colon with a PRINT command in order to prevent a new-line being automatically appended, e.g.
PRINT "Hello, World"
Prints “Hello, World” followed by a newline (actually carriage return + line feed)
Whereas:
PRINT "Hello, World" ;
Will print “Hello, World” without the newline.
How do I write long lines in my programs and continue the script on the next line without getting a screen error or syntax error?
Unfortunately the current MMBasic has no line-continuation feature or long line editing support in the EDIT
command. You would need to edit via a serial terminal or use the MMEdit application.
It may be possible to start the EDIT
or with a smaller font, you’ll need to consult the manual, I don’t have a device myself to experiment with.
I tried an example program from the manual such as SQR(a * a + b * b) and I get an Unknown command error.
The error message contains a hint; SQR()
is an in-built function not a command you need to PRINT its value or assign it to a variable or use it in an expression.
Best wishes,
Tom
Thanks again to the community for helping a newbie.