Techness March 2013 | Page 3

Make a Program!

Guides

3

First off lets look at the interface. We will only cover the two important things here. The first is the main screen. This is where you enter your code that you want to run. Why not type in:

PRINT "HELLO WORLD"

END

Now lets move on to the next thing. The run toolbar. Click it, Now you will see a list of commands. The only one we are interested in is the "RUN" command. Click it, a screen should pop up saying HELLO WORLD. Well done! You made a program! Now lets expand it and explain it.

Clear the code so you have a blank screen. Type in:

INPUT PROMPT "WHAT IS YOUR NAME?":name$

Now lets explain that code. "INPUT PROMPT" is exactly what it sounds like, It will display what is in the speech marks (In this case "WHAT IS YOUR NAME?" and then allow the user to type in an input. The next part ":name$" is the REALLY important bit. The ":name" part is the VARIABLE name. We call it name since that is what we are asking for. Whenever we do a input prompt we have to put this behind it to save the input to! The "$" part means it is an ALPHANUMERIC VARIABLE. an alphanumeric variable is a variable that consists of numbers and letters. Missing out the $ sign will only allow the user to input numbers. This comes in handy when you want to make a calculator and are asking for two numbers. We would save them as num1 & num2 without the dollar sign. We could then do num1 + num2 = num3 (Thats nearly working code!! Just an example!). But if we done num1$ + num2 we would get an error since num1$ is considered text at this point.

Right back to our program. The next we want to type is:

PRINT "HELLO "; name$

This is an easy bit! What we are doing is PRINTing the "Hello " to the screen then right beside it printing whatever the user inputed in the INPUT PROMPT section. the ";" means it will print on the same line!

Now our code will still not run?!? What have we missed?? Thats right! The END statement! Why dont you just chuck that right on the end there on a new line after the PRINT line.

So now your code will look like this:

INPUT PROMPT "WHAT IS YOUR NAME":name$

PRINT "HELLO "; name$

END

Now go to that run button and run it. Congrats! You made your first program!

Now this is a really basic program that you can make with the Demo but if you feel up to it "TrueBASIC Bronze" is only $39.00 and well worth it! This version will give you all you need to make fun programs but there are "Silver" & "Gold" versions available but I have never needed the Gold since I use Silver.

There are many tutorials online that will let you do many things like:

-Make a calculator

-Make a notepad like program

-Make animations

So thats all for this months programming feature! Tune in next month for another one!