| Author |
Message |
tinman47 Lord of Gaming

 Joined: 24 Feb 2007 Posts: 231
|
Posted: Fri Apr 27, 2007 8:47 pm
Post subject: Qbasic Programmers,I need some help. |
|
|
After a few weeks of studying QB,I finally have a grasp on QB(IN JUST 2 WEEKS! ).QB is awesome.It allows your dreams to come true with a few or alot of commands with no knowledge at all,just common sense.But anyway,I've been programming in QB today and I came across a problem;the SUB and GOSUB command.Without these two commands,I will have a much harder time making big games and apps.Reply your technique or even reply techniques for game design.Thank you.  |
|
| Back to top |
|
 |
dosraider Moderator

 Joined: 15 Mar 2005 Posts: 4997 Location: ROTFLMAO in Belgium.
|
Posted: Sat Apr 28, 2007 3:34 am
Post subject: Re: Qbasic Programmers,I need some help. |
|
|
| tinman47 wrote: | | After a few weeks of studying QB,.......with a few or alot of commands with no knowledge at all,...a problem;the SUB and GOSUB command. |
Sorry for that.
Get real will ya ? If you even don't understand the SUB nor GOSUB lines, you hardly can state "I finally have a grasp on QB".
Put your lazyness aside and study a bit more. If you ever want to be able to program something : LEARN. |
|
| Back to top |
|
 |
emmzee Site Admin

 Joined: 14 Sep 2002 Posts: 1886 Location: Mississauga, Ontario, Canada
|
Posted: Sat Apr 28, 2007 9:47 am
Post subject: |
|
|
Here's what seems to be a decent tutorial:
http://tedfelix.com/qbasic/
(It includes some info about how subs and functions work) |
|
| Back to top |
|
 |
Swiftcutter Experienced Member

 Joined: 23 Jun 2005 Posts: 52
|
Posted: Sat Apr 28, 2007 11:07 am
Post subject: |
|
|
A sub (subroutine) is like a mini-program that you can run from the main program. That way, instead of typing the same code over and over at different places in your program, you can just make it a sub and run that.
Here's an example. This program will generate three random numbers between 1 and 10 and print them to the screen.
| Code: | 'This part defines the sub. It must come before anything else in the program
SUB roll10
PRINT (INT(RND*10)+1)
END SUB
'This part is the main program. It runs (or "calls") the "roll10" sub three times.
RANDOMIZE TIMER
CLS
roll10
roll10
roll10 |
To keep things organized, Qbasic stores your subs separate from the main program code. Press F2 to access them.
Hope that helps. I'm moderately well-versed in Qbasic, so LMK if you have any more questions. :) |
|
| Back to top |
|
 |
tinman47 Lord of Gaming

 Joined: 24 Feb 2007 Posts: 231
|
Posted: Fri May 04, 2007 5:35 pm
Post subject: |
|
|
Great,this completely solved my problem!
Thanks...
FOR DESTROYING THE EVIL IN MY SOUL...  |
|
| Back to top |
|
 |
|