A statement is a single instruction to be carried out. In Small Basic we have 1 statement per line. We type these statements in the Small Basic IDE (Integrated Development Environment).
Type in the statement shown and save it somewhere. Then click Run.
You should've got the following output.
The line you typed in is 1 statement.
TextWindow is an Object, the period (or fullstop) is a member accessor
WriteLine is a method and member of the TextWindow object.
Now write the same using
TextWindow.Write instead of
WriteLine. This code is 2 statements
and produces the same output all on 1 line, illustrating the difference between
WriteLine to work. We'll write code that asks the user for their
name, waits for them to type, then press enter, then writes it as output to a line.
TextWindow.Read() tells the program to wait for the user to press enter and then reads what the user typed.
We store this data in a variable called
userName then write it to a new line using
+ sign used in this sample is an operator that tells the program to concatenate the variable
userName to the literal string "Your name is: ".