Starting up.
Now that you have Small Basic (we shall now call it the console) You need to write your first program!
You should have something like this:
You should have something like this:
Now were ready to write our first ever program!
The first thing you need to do in programming is...... HELLO WORLD!
To do this we need to use the following line of code:
TextWindow.WriteLine("HELLO WORLD!")
when you run it it should look like this:
The first thing you need to do in programming is...... HELLO WORLD!
To do this we need to use the following line of code:
TextWindow.WriteLine("HELLO WORLD!")
when you run it it should look like this:
So how does it work?
Well textwindow is the blackwindow that has appeared, and the command .writeline writes a line upon the screen in this case ("HELLO WORLD!")
If your still with me we can move on a little bit.
You need to use the code:
TextWindow.WriteLine("What is your name?")
name = TextWindow.Read()
TextWindow.WriteLine("Hello " + name)
When you run it it should look like this:
Well textwindow is the blackwindow that has appeared, and the command .writeline writes a line upon the screen in this case ("HELLO WORLD!")
If your still with me we can move on a little bit.
You need to use the code:
TextWindow.WriteLine("What is your name?")
name = TextWindow.Read()
TextWindow.WriteLine("Hello " + name)
When you run it it should look like this:
So how does it work?
Well you know how the WriteLine works, When we ask for the name We use code: name = TextWindow.read() using this we are saying that the variable name is whatever they type in on the textwindow. Now when we ask the text window to say ("Hello " + name) we are asking it to write hello and whatever you typed in on the screen. In this case i typed in james so it shall write hello james.
If you are following me we can move on to writing a calculator!
to do this we need the code:
TextWindow.Writeline("Ask me a + question first one number and hit enter and then the second number")
Number1 = Textwindow.Read()
Number2 = Textwindow.Read()
Number 3 = Number1 + Number2
TextWindow.Writeline("The answer is " + number3)
It should look like this:
Well you know how the WriteLine works, When we ask for the name We use code: name = TextWindow.read() using this we are saying that the variable name is whatever they type in on the textwindow. Now when we ask the text window to say ("Hello " + name) we are asking it to write hello and whatever you typed in on the screen. In this case i typed in james so it shall write hello james.
If you are following me we can move on to writing a calculator!
to do this we need the code:
TextWindow.Writeline("Ask me a + question first one number and hit enter and then the second number")
Number1 = Textwindow.Read()
Number2 = Textwindow.Read()
Number 3 = Number1 + Number2
TextWindow.Writeline("The answer is " + number3)
It should look like this:
So how does it work?
Well were saying that number1 is whatever they type in and number 2 is whatever they type in next and number3 is number1 + number2
And then we tell the textwindow to say the answer is number 3
TIP!
If you are using variables in text then dont forget the + sign e.g. TextWindow.Writeline("Hello " + name)
For more advanced programming goto advanced.
Well were saying that number1 is whatever they type in and number 2 is whatever they type in next and number3 is number1 + number2
And then we tell the textwindow to say the answer is number 3
TIP!
If you are using variables in text then dont forget the + sign e.g. TextWindow.Writeline("Hello " + name)
For more advanced programming goto advanced.