When you first start programming, it is customary to begin with a hello world program. Type the attached code in the editor then switch to the run window, type RUN and hit enter to get the program to execute.
The print command prints out the text between the double quotes, in this case Hello World. Try modifying the code to write something different to the screen.
As you move on you will want to save things in variables. Line one - option strict - turns on requiring variable declarations which is useful. Line 2 - var - declares two variables name$, and age%. In SmileBasic you set the type of variable by the symbol on the end of the variable name. % is for whole numbers, # for numbers with a decimal point, and $ for strings which hold text/words.
Lines 4 and 5 let you ask the user for data and save it into a variable. One we are finished with that we make a decision in the code with IF. Between IF and THEN you write an expression that evaluates to true or false in the case we compare age% to a set number. If the expression is true the next block of code is evaluated otherwise it is skipped. You can add extra checks with elseif.
if you use else it runs only when the original if and any elseif statements were never executed. endif says you are done with the if command. For each condition we print out some text. Note how we can glue bis of text together with +. On numbers that would do addition instead. str$ changes a number into a string. I hope that all makes sense.
Attached is a small number guessing game. You get a random number between 0 and one less than the number entered in parenthesis with the rnd() function. The repeat/until command will execute a block of code over and over until a condition is true. Otherwise everything else in the code should look familiar. Let me know if you have questions or want more examples.
The first half looks ok, but after that, I think you want something like:
var name$
input "Give our hero a name"; name$
if name$ =="2" then
print "That's a cute name."
endif
Thanks. To run the program there are two buttons on the bottom left display [I think], and edit switch from edit to display [I think] then either type run or click the run button in the upper right of the bottom screen and hit enter to run what you typed in in edit mode. Hold down the L button and click the save or load button to save/load what you wrote in edit mode.