Nigma: BASIC for Beginners

  • Two Factor Authentication is now available on BeyondUnreal Forums. To configure it, visit your Profile and look for the "Two Step Verification" option on the left side. We can send codes via email (may be slower) or you can set up any TOTP Authenticator app on your phone (Authy, Google Authenticator, etc) to deliver codes. It is highly recommended that you configure this to keep your account safe.

Taskmaster

Godlike - I like God
Nov 29, 1999
953
0
0
www.geocities.com
Nigma, I'll do my best to help you at least look into whether or not programming is something you will be interested in.

First, every one has a BASIC interpreter on their computer, if they are running some version of Windows. I can run you through a little lesson of sorts using it.

Open a DOS shell (Window). At the C:> prompt type in QBASIC. This is basically an editor, but it is specifically for BASIC. It will recognize BASIC keywords and automatically capitalize them for you. It also has help for all the BASIC keyword and data types built in! Very helpful program.

To begin with select the Options menu and then select Display... under that. Change Tab setting to something useful like 3 or 4. Eight is too large for any real nesting of statements. You only need to do this once as the value should be saved for next time.

BASIC is a top-down programming language (if you do not count Visual Basic) meaning that instructions are executed in order starting at the top and going down, unless the instructions cause the program flow to change (ie. skip lines, conditional statments, goto). Pretty straight foward, I hope.

Please feel free to post any questions you have and I'll try to answer them as simply as I can.

Let's write a small little program in the editor.

1) We need to define any variables we use. Care must be taken because BASIC (some versions) do not alert you to typos, it just assumes it must be a new variable. If you are using a variable named "wages", but you accidentally spell it as "wags" in one place, BASIC will just think you have two variables and you will have to find the problem on your own! QBASIC does this...

Type in the first line as follows and press enter. If the words "DIM", "AS" and "INTEGER" capitalize it is correct.

<BLOCKQUOTE><font size="1" face="Tahoma, Arial, Helvetica">code:</font><HR><pre>dim i as integer[/code]

This tells the QBASIC interpreter to dimension, or save room for, an integer by the name of "i" which is a common loop index variable.

2) Now we need to get the computer to do something simple. Let's print your name a few times on the screen.

<BLOCKQUOTE><font size="1" face="Tahoma, Arial, Helvetica">code:</font><HR><pre>
CLS
FOR i = 1 TO 10
PRINT "Nigma"
NEXT i

END
[/code]

Type each line in lower case so you can tell if it is correct when the words capitalize as I have shown above.

You can move you cursor to the line that reads CLS and press F1. You will get the syntax for using CLS and you will learn that CLS clears the screen.

The next code is a "FOR" loop that will loop 10 times and execute everything it finds until the NEXT command is hit. In this case it will print your name and then loop back to the top repeating 10 times.

Let's see how it works. Using the RUN menu select Start or press SHIFT+F5 and the program will run and you will see the following:

Nigma
Nigma
.
.
.
Nigma
Nigma

Okay, that is it... simple huh?

Exercise 1) Using help for PRINT determine what adding the ";" and "," to the end of the PRINT line do to the program.

Exercise 2) Look up help for the keyword LOCATE and see if you can print your name starting at line 5 instead of line 1.

I'll think about what we will do next....

------------------
I declare myself to be the self-annointed voice of reason for PuF! Opinions expressed by Taskmaster are not necessarily those of Planet Unreal! /~unreal/ubb/html/smile.gif

[This message has been edited by Taskmaster (edited 02-23-2000).]

[This message has been edited by Taskmaster (edited 02-23-2000).]
 
F

[FiS]Prophetus|PUF

Guest
STTTTOOOOOPPPPPPP! MY HEAD HURTS! /~unreal/ubb/html/smile.gif Glad someone know that chit. You are smart after all task...hmmm...noone would of guessed /~unreal/ubb/html/smile.gif
 

CHRYSt

You can't help that. We're all mad here.
Jan 14, 2000
4,851
0
0
45
www.crawlspaceradio.com
I think Task might know a little more than he lets on. If only COM and MTS components were that easy.

bullet2.gif

"Where's the BACTINE?! Some of this blood is MINE!!" -- JTHM
 

Taskmaster

Godlike - I like God
Nov 29, 1999
953
0
0
www.geocities.com
Task is not dumb, just humble... at least most of the time. CHRYSt.. I sure wish that COM was that easy... hehe. I've not worked witht the Microsoft Transaction Service yet... but apparently we will be using it soon.

Nigma expressed an interest in seeing if programming was something he wanted to pursue so I thought I would give him a quick intro to "thinking like a programmer."

/~unreal/ubb/html/smile.gif


bullet2.gif

I declare myself to be the self-annointed voice of reason for PuF! Opinions expressed by Taskmaster are not necessarily those of Planet Unreal! :)
 

SSSHAD

New Member
Dec 8, 1999
394
0
0
Sydney, NSW, Austr.
Can't believe there's something more difficult than BASIC. I remember&lt;back in high school&gt; writing a simple program that makes your screen go with dots. It took about 30 lines to complete!
 
F

[FiS]Prophetus|PUF

Guest
No, BASIC isn't hard...But, learning any "New Language" takes a bit to get used too. Nigma is starting out and wanted to see if he can do programming. BASIC is a good place to start I guess...
 

Lizard Of Oz

Demented Avenger
Oct 25, 1998
10,593
16
38
In a cave & grooving with a Pict
www.nsa.gov

Zaccix

Truth, by Banksy
Nov 10, 1999
3,370
1
36
London, UK
I remember learning a version of Basic called AMOS years ago on the Amiga. I even managed to write a small text adventure game which was based on my house /~unreal/ubb/html/smile.gif

I'd love to learn a language like C++. A friend of mine has been pointing me in the right directions, but the problem is that, even though I've got the tools to do the job (i.e a compiler and such), I still haven't found a tutorial that takes you from scratch and gently eases you in. All the ones I've found start off by saying "it's not that difficult to learn", then suddenly they go off the deep end faster than an Olympic swimmer!


bullet2.gif

"I put a spell on you, 'cos you're mine." - Nina Simone.
 
N

NIGMA666

Guest
Thanks Task!

and Damn you Rooster!!!!

-=666=-

bullet2.gif

"Man who stands on toilet, high on pot"

{PuF}NIGMA666
 
N

NIGMA666

Guest
Thanks Liz, im get that QBASIC app now ill see if that works.

Thanks again Task!

-=666=-

bullet2.gif

"Man who stands on toilet, high on pot"

{PuF}NIGMA666
 

Sky

New Member
Nov 10, 1999
315
0
0
Visit site
Task your awesome. I have been wanting to play with programming but it seemed to burn my skull. Your way of explaining is easy to understand. I wish you could teach a course where I live.
 
N

NIGMA666

Guest
It worked! YaHooooo!

thanx Task you kick a$$ /~unreal/ubb/html/wink.gif
i cant wait to see what you have for me next.

well Sky, he lives near me tho, but Task i guess your not really into the whole meeting me thing?
im only 18 and im not a psycho, but its your call! i would be glad to learn from you tho /~unreal/ubb/html/wink.gif
im just more of a visual learner, one reason i suck at school ;(

Thanx,

-=666=-

bullet2.gif

"Man who stands on toilet, high on pot"

{PuF}NIGMA666
 

Taskmaster

Godlike - I like God
Nov 29, 1999
953
0
0
www.geocities.com
Nigma, I have no problem meeting you per se, but I am employeed, which means I have to work from 9 to 6, before which I have to get up and get my kid ready for school. Then when I get home I usually have something going on... I have to eat, spend a bit of time with my daughter, play some UT then go back to bed.

Basically I only have Saturdays free if there is not some event planned. Maybe one Saturday.

QBASIC should be on your machine, it just may not be in your path. I have Win NT and it is there. Do a file search and you will problably find it ina a \WINDOWS\COMMAND directory, but I have been wrong in the past.

So Nigma, I am more than willing to teach you this way for as long as I can think of stuff to teach you. I also have no problem helping others if they want to follow along.

However, I expect you to cut and paste the answers to the exercises i the other BASIC thread I started, so that I can ensure you are getting them right. /~unreal/ubb/html/smile.gif


bullet2.gif

I declare myself to be the self-annointed voice of reason for PuF! Opinions expressed by Taskmaster are not necessarily those of Planet Unreal! /~unreal/ubb/html/smile.gif



[This message has been edited by Taskmaster (edited 02-24-2000).]
 
N

NIGMA666

Guest
Thats cool i understand man /~unreal/ubb/html/smile.gif

yeah i could not find QBASIC on my comp but i DL it from that link Liz gave me and that works really well! ill get started on your new lesson right now /~unreal/ubb/html/wink.gif

Thanx,
NIG



bullet2.gif

"Man who stands on toilet, high on pot"

{PuF}NIGMA666
 

Taskmaster

Godlike - I like God
Nov 29, 1999
953
0
0
www.geocities.com
Well, get those couple of exercises done and paste them to the other thread so I can see them.. I'm trying to think about what is next. There is so much stuff, that I don't want to get bogged down in just the syntax of BASIC, but rather the ideas behind programming. That is the real trick. Once you know the way programming works, you can apply it to any computer language.



bullet2.gif

I declare myself to be the self-annointed voice of reason for PuF! Opinions expressed by Taskmaster are not necessarily those of Planet Unreal! :)
 

Taskmaster

Godlike - I like God
Nov 29, 1999
953
0
0
www.geocities.com
Where's your homework Nigma? Apparently I have to act like your mom and harrass you until you post your exercise code up to the other thread! I'll put a little tutorial on how to copy-n-paste from a DOS window on the other thread just in case... /~unreal/ubb/html/smile.gif


bullet2.gif

I declare myself to be the self-annointed voice of reason for PuF! Opinions expressed by Taskmaster are not necessarily those of Planet Unreal! :)
 

tykeal

New Member
Dec 28, 1999
211
0
0
Tacoma, Wa, USA
www.bardicgrove.org
Oh geeze Task... I almost replied to you at the end of your thread... but I'll abide by your wishes :p

Go ahead and teach em how to add Hex and bin *evil grin* it would be good for the soul *cackle*

BTW... did you know that 132 counted out on your fingers in binary is a real interesting configuration? So interesting I have a couple of friends that would put down the bin at the bottom of exams from profs that they didn't like *grin*

bullet2.gif

I belch in your general direction.
 

Taskmaster

Godlike - I like God
Nov 29, 1999
953
0
0
www.geocities.com
132 decimal = 00100 00100 /~unreal/ubb/html/smile.gif

Double birds eh!

Geeks! /~unreal/ubb/html/wink.gif



bullet2.gif

I declare myself to be the self-annointed voice of reason for PuF! Opinions expressed by Taskmaster are not necessarily those of Planet Unreal! :)