> Sford wiki > Sford Basic tutorial > Sford Basic tutorial 2

1 - 2 - 3 - 4

In lesson one, you learned four commands:

Here is another command. Type this:

print "hello world!"
print 4 + 99
print "three times seven is"; 3 * 7

Note the semi-colon used on the last print line. It separates two things that you want printed. The first thing is the string "three times seven is". And the second is the arithmetic calculation 3 * 7. A string must be inside double-quote marks, and is just some text that the computer doesn't try to understand. If you type some stuff to be printed and it is NOT enclosed in double-quotes, then the computer will try to interpret it as either a number or a calculation. Also note that the output of the "print" command smooshed together the string and the calculation. The semi-colon tells the computer to smoosh them. Try it again with:

print "three times seven is "; 3 * 7

See the space before the end quote? That makes the output nicer.

One more:

print "Never eat "; 27 / 9; " pizzas"

Back in the old days, you used a computer with a device that printed the computers output on paper instead of showing it on the screen. So the command "print" made sense. Now it just means "display".

Now do this:


The new tells the computer that you want to start a new program. It erases whatever program is currently in Basic.

Now type:

10 print "hello world!"

Notice that when you typed 10 print "hello world!" it did not actually do the command. It just remembered it as a line of program.

Now type:


CONGRATULATIONS! You have just written your first successful program! But the two hours is not up yet! There is more to do.

Ready for Sford Basic tutorial 3?

Retrieved from "http://wiki.geeky-boy.com/w/index.php?title=Sford_Basic_tutorial_2"