Qbasicnews.com
May 25, 2020, 11:46:28 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News: Back to Qbasicnews.com | QB Online Help | FAQ | Chat | All Basic Code | QB Knowledge Base
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: not equal  (Read 1546 times)
winhack
New Member

Posts: 13


« on: May 01, 2004, 10:26:39 AM »

okay here is my problem........

is there away to have like alot of variables in one if statment like
Code:

if inkey$ = "d" "o" "g" then print "hello"

and how do i make it not equal like

if inkey$ dosnt equal "d"
and so on is there a way to do these things

i am new to qbasic so these might be simple questions

first post woot
Logged
HQSneaker
Wandering Guru
***
Posts: 394



WWW
« Reply #1 on: May 01, 2004, 10:44:49 AM »

like this:
Code:
IF INKEY$ = "d" OR INKEY$ = "o" OR INKEY$ = "g" THEN


not equal:  
Code:
IF INKEY$ <> "d" THEN
Logged
winhack
New Member

Posts: 13


« Reply #2 on: May 01, 2004, 10:58:17 AM »

woot thanks man that exactly what i was looking for also i have another question

when ever i use this
if inkey$ = "a" then circle (90,90)
and after i make the circle by pressing a then i rerun the program and it dosnt clear the screen even if i hade cls at the beging
Logged
HQSneaker
Wandering Guru
***
Posts: 394



WWW
« Reply #3 on: May 01, 2004, 12:35:54 PM »

Make sure you don't use Ctrl+Break, because it'll start where it ended. Just make an Esc-key feature in a loop:

Code:
CLS
DO UNTIL INKEY$ = CHR$(27)
IF INKEY$ = "a" THEN CIRCLE (90,90), 10, 4
LOOP
Logged
whitetiger0990
__/--\__
*****
Posts: 2964



WWW
« Reply #4 on: May 01, 2004, 12:47:14 PM »

Or use Shift-F5 instead. It restarts the program from the very begining
Logged


[size=10]Back by popular demand!
I will byte and nibble you bit by bit until nothing remains but crumbs.[/size]
DrV
Na_th_an
*****
Posts: 1553



WWW
« Reply #5 on: May 01, 2004, 05:30:06 PM »

Quote from: "HQSneaker"
like this:
Code:
IF INKEY$ = "d" OR INKEY$ = "o" OR INKEY$ = "g" THEN


not equal:  
Code:
IF INKEY$ <> "d" THEN

This won't work as written - calling INKEY$ clears the key buffer, so you'll want to do something like:
Code:

key$ = INKEY$
IF key$ = "d" OR key$ = "o" or key$ = "g" THEN
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines Valid XHTML 1.0! Valid CSS!