The First Step


Before you can program you must have
freebasic and an editor to develop in.
If you dont have freebasic, you can
find it here: You should download an editor named
jellyfishpro or jfishpro for short.
You can also download fbide or fbedit.
The freebasic site should cover this.
Now that you have the tools you need
we can start setting up. Open jfish pro
and click compile THEN click set compiler
defaults. THEN change the top bar to
wherever you installed freebasic(fbc.exe).

Time To Program


Time to do the obligatory "hello world"
program. Open jfish pro and THEN click new.
Type or copy/paste this
code:

Print "hello world" sleep

code end.
Now press f5 or click
compile THEN build/execute.
sleep can also be changed to
any number measured in milli-
seconds. This next program will
demonstrate this.
code:

 Print "c:" 
 Sleep 2000
 Print "c: dos" 
 Sleep 2000
 Print "c: dos run"
 Sleep 2000
 Print "c: dos run boy run"
 Sleep 5000
 end

code end.
This next code demonstrates using
for/next to execute a statement 20 times
Be sure to set compiler for -lang qb for
the next few examples.
Code:

Dim a As Single
For  a= 1 To 20 Step 1
Print "You've Been Owned"
Next
Sleep 
End

code end.
Now we will look at doing some loops.
This code loops ten times as it adds
1 to itself. Thus counting to ten.
Code:

Dim a As Integer
Do 
a = a+1
Print a
Loop Until a = 10
Sleep
End

Ok, now lets start doing something
useful. This next code checks the
system time and functions like an
alarm clock.
Code:

Dim a$ 
Do
a$ = Time
If a$ = "11:05:00" Then
 Gosub alarm
End If
Loop Until 0
alarm:
Print a$
beep
Sleep 500
beep
sleep
End

Change "11:05:00" to two minutes in the
future and compile the program. In two
minutes, the cmd shell will display the
system time. Well that was fun, but lemme'
explain that last code. Dim means "dimension"
it just lets the computer know you're about
put data into a "string" just like algebra ie
e=mc^2. where e holds the energy data and m holds
the mass data and so on. So now why is there a $?
That simply means you're going to input data that
is not a number. We have to use that because ":"
is not a number. Gosub means goto a subroutine ie
goto "alarm:" and the return to the next line.
"GOTO" would have worked as well but generally
GOSUB is better to use. Now lets get some user input.......
Code:

Input "What is your name"; a$
Print a$; " is a stupid name!!!!"
Sleep 5000
Cls
Input "*Sigh* Now what do you want"; b$
Print "I dont care about "; b$
Sleep

Code end.
Now you know the basics of freebasic/qbasic!!
Happy coding!