Helow beginner Coderz,
In this tutorial im going to show you how to code your really first program, we are going to use the language
"Basic", wich is a really easy to understand language for everyone and it's great to start with.
I very recommend to learn Basic before you get started with anoter language like C, C#, C++.
If you have any questions or things you do not understand please ask me for help. I work with the same structure
as always, i'll tell you wat we're going to do, show you an example, and explain the example. All i can say, let's start!
Note : Make sure you've got an compiler to test your codes, i recommend "Free Basic" wich is free and ez to use.
You can download Free Basic here :
Download1.Save Your Program:So you want to make your own program, sounds interesting. Well, the first thing we're going to do
is write a little code, in notepad. This is what we're going to code:
- Code:
-
CLS
PRINT "Hello, this is my first program"
END
2.What does it means?Let's start with our first rule, if we take a look at our first rule we see "CLS". CLS is a default command wich
makes your screen empty. Next, our second rule, we see "PRINT". PRINT is another default command wich
provide text on your screen. And then our last rule, "END". Quess what? it means the end of the program.
3.Test your Program!GoodJob, sir. You coded your first program
. Now you probaly want to see, the result? Open up, your
notepad file, and click on "File">"Save As..."C Drive">test.bas>All Files. Important to save your file, correctly.
What i always, do is i save it on my C drive becuz the C Drive is easy to reach, then i give my file a name, i call
it test, but on the end of the name i type in = ".bas" , i do this beceause this will change my txt file to a bas file. Now
to prevent my file will be a txt file, i say save the file as all files, after that im ready to save my file and the save file
part is done.
4.Run your Program!Open up, Free Basic , and type in the following code ; "fbc -lang qb C:\test.bas" ( without those "" ) , run the
test.exe and there you go, your first program congratulations!
5.A little addon to you scriptIt's cool, you've just made your own program, but it's not really amazing or something, thats why we're now
going to add a little thing to your script. Open up notepad and type this in ;
- Code:
-
CLS
INPUT "He you, enter you name! ", b$
PRINT "Did you just enter "; b$; " ? That's a beautifull name!"
END
Ok so CLS makes your screen empty, A new command is INPUT shows "He you, enter your name!" and
beceause of the INPUT command the user is able to type in his/her name into the variable b$. b$ is a variable
that saves the letters the user types in. You can type any name you want for the variable just as long it ends with $
We alrdy know what the PRINT command means, it just shows you that sentence between the "", after the user has
type in his or her name. And END wich close the program. We type " ; ; " beceause this will add the 3 text parts on the 3th rule togheter as one sentence if you don't add these " ; ; " your program wont run proper, and might crash.
6.Finish!Goodjob, you just finished your first lesson Basic. It wasn't that hard right? Stay tuned for the next Basic tutorial
for more info you can leave a comment below, but do not send me personal mesages about this thread. Becuz, i'll
see that as spam, and i'll auto delete those mesages. Good luck and maybe you can play a little bit with the scipts.