Case Statement

User avatar
GeorgeMcGinn
Posts: 435
Joined: Sat Sep 10, 2016 6:37 am
My devices: IPad Pro 10.5in
IMac
Linux i386
Windows 7 & 10
Location: Venice, FL
Flag: United States of America
Contact:

Re: Case Statement

Post by GeorgeMcGinn »

Thanks for that I will keep that in mind. I found a lunar lander program written in SDLBASIC on the UNIX machine, and it seems like a very simple convert to SmartBASIC. (It's even a simple conversion to TechBASIC, but I've already committed myself to do the conversion and smart basics first.) It comes with a pretty good set up Graphics use the sprites and just as regular graphics in the program, so we'll see how the conversion goes.

I have to do some conversions for color because it uses the RGB statement like in PowerBASIC. Once I come up with a standard way to convert the RGB (100, 100, 10) to the values of color between 0 and 1 that SmartBASIC uses, I will post that in the library section as it will be a library function that you can call to do the conversions. Will help others when they encounter the same statements that use the RGB zero through 255 instead.

It has key statements and this will give me the opportunity to try the ON GOTO or the ON GOSUB to replace the key statements that have a lot of code attached to them.



Henko wrote:
Wed May 15, 2019 9:43 pm
I would not do the error handling (printing a message) within the function, but only do the error checking and leave the handling to the calling program.

An obvious case : when the program is in the graphics mode, you will not have an error message.
Some of the examples given simply return an empty string in case of error. That seems the right thing.
George McGinn
Computer Scientist/Cosmologist/Writer/Photographer
Member: IEEE, IEEE Computer Society
IEEE Sensors Council & IoT Technical Community
American Association for the Advancement of Science (AAAS)

Post Reply