|
Post by piegopher on Mar 12, 2002 20:54:53 GMT
The other day I looked at qbasic with new eyes... for some reason. I realized that there was a whole bunch of stuff there that I have never questioned... and a few things that I really should know by now...
1. Subs. I dont know the first thing about subs... I read the help file... or at least looked at it. I decided not to read it because I am too lazy to read. Can someone explain the syntax to use them or something?
2. The "immediate" windowette. It's ALWAYS there, and the only thing I know about it is that it's easy to accidentally full-screen it. What's it do???
3. To get a random number from 1 to 50 I use int(rnd * 50) + 1, but to get a number between -5 and 50 I'd use (int(rnd * 56) + 1) - 6. Why doesn't int(rnd * 50) - 5 work?
Now I have to go, as I've been distracted by a fly.... eeeee.....
|
|
|
Post by fly@aol.com on Mar 13, 2002 0:02:17 GMT
you're too lazy to read the help files, but you'll read our posts? the help files will do a better job.
the immediate windowette lets you run code bits without running the whole thing
|
|
|
Post by piegopher on Mar 13, 2002 19:04:29 GMT
Bah! I dont need your half-breed vulcan logic! Checking help files is very tiring for me because I can't break the habit of doing it without a mouse... type word-F1-Alt H-down-enter-back... but then again I AM special in the head... Anyhoo... so you copy code into the immediate window and you can run it? is that how it works?
|
|
pebe
Junior Member
Posts: 39
|
Post by pebe on Mar 13, 2002 20:04:52 GMT
If you're using QB45 then help is but a keystroke away! Enter your keyword and then right click on it. Down drops a screen with help for that keyword. Magic!
F6, the direct screen is entered a line at a time for a command line to be run directly - ie, not as part of your program, but for test purposes.
Hope that helped.
|
|
|
Post by brisray on Mar 13, 2002 20:28:17 GMT
The immediate window is more useful than that.
You can run lines of code in them. Say you've opened some files and you need to check what's in them before the program finishes. you can stop the program, type CLOSE, then open the files in notepad or whatever. I'm used to working on networks so I always use files read and write locked, that means they have to be closed before they can be opened by anything else.
Also if you want to check the variables in a program say mystring$, you can pause the program type ?mystring$ and it will print the variable to the screen.
Ray
|
|
|
Post by Chriss on Mar 14, 2002 5:27:01 GMT
???Ahhhhh! I am REALLY confused now! I always wondered what the immediate screen was for.... now I know less than I did.... Oh well.. maybe in time...
|
|
pebe
Junior Member
Posts: 39
|
Post by pebe on Mar 16, 2002 23:55:25 GMT
Well Chris, here are a couple of examples of how *I* use it.
1. I want to make up a sub 'menu' which displays a menu screen for the user. I want it to look presentable and get the text in the right place. Instead of running the program from the start each time, to test it, I go into immediate mode and 'CALL [the sub]'. QB will just run that sub without the main program.
2. I want to know what value a variable a% has when the program has reached a certain point. At that point, I insert a temporary line 'INPUT T'. Then run the prog. It will stop at INPUT T waiting for an entry. Press CNTL/BREAK to stop the prog. Press F6 and write the line: LOCATE 1,1:PRINT a% and up it pops on the screen
Hope those examples help.
|
|