- HubPages»
- Technology»
- Computers & Software»
- Computer Science & Programming
Making Your Own Computer Programs: Part 1 Very Basic BASIC
Creating your very own computer program can be daunting at first. However it is not as hard as you may first imagine. When you first get a look inside a program at its code it can be hard to get your head around how it works. But once you learn the basics it becomes easy to create simple little programs and even more advanced ones.
I started programing as a 10 year old on a Spectrum that used ZX BASIC. Today I use a PC with Just BASIC, which although it has some differences is fundamentally the same.
Creating Your First Program
First you will need your coding environment. As I stated above I use Just BASIC which is a fully functional and free coding environment. Click the link below to get your copy.
Not only is this software free for personal use, it is also free for commercial use as well, meaning you can sell your finished products.
The Basics
Once you have your copy of Just BASIC open it and you will see a text editor style window come up with some grayed out writing. This is your working environment.
First thing you will need to do is delete the grayed out writing so you have a clean page to work on.
Now lets start off easy with a basic print command that prints text on to a window. (See First Steps Below)
First Steps
Print "Hello World"
Now how about getting the computer to ask you some questions?
This is quite simple as well. (See Below For Code)
Asking and Answering Questions
Input "What Is Your Name?"; Name$ Print "Hello "; Name$
This little bit of code will get the computer to ask for user input which it then prints after the enter button is pressed.
The Name$ part of the code is how it saves your input for printing out. This can be used in many different ways as you will see later on in this tutorials.
Outcome of Code
Making The Outcome a Little Easier To Read
Input "What Is Your Name? "; Name$ Print "" Print "Hello "; Name$
The Print "" command will place a blank line between the question and the answer making it a little clearer to read.
Homework before next tutorial
More Q & A With Tailored Responses
Lets add some more questions to our program.
Tasks
- Get Computer to ask for gender
- Get Computer to ask for age
- Get Computer to ask for favorite color
- Get Computer to ask for favorite food
- Get Computer to print all the answers.
Tips
- Each answer needs its own name (Name$ etc)
- Each Question and answer should be on a new line.
- Use the Print "" command to separate lines.
What I Think Of Just BASIC
Just basic is for me the best free coding environment for the PC. It is fairly powerful and can do many great things.
It has a GUI editor and makes great programs that use a Graphic Interface because of this.
It is simple to learn and use and come with a wealth of information in its help files and on its forum.
But don't just take my word for it. Try it yourself today. Come on its free.
Command Reference
Input - This tells the computer to print what is in the "" then wait for the user to respond
Print - This tells the computer to print the contents of the "" and or and strings (a$, Name$ etc) that or on that line.