Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Continue by hitting a certain key
#21
Oracle,
so does mine. It loops as long as K$ is not a substring of Choice$, which is a list of available keys. Try it.
hrist Jesus came into the world to save sinners, of whom I am first.(I Timothy 1:15)

For God so loved the world, that He gave His only begotten Son,
that whoever believes in Him should not perish, but have eternal life.(John 3:16)
Reply
#22
Quote:Oracle,
so does mine. It loops as long as K$ is not a substring of Choice$, which is a list of available keys. Try it.

Confusedhifty:

I suck...

;*)

Whose is faster?
Reply
#23
I don't know. I was wondering the same thing, but since you are waiting for a user input, I don't think there could be enough difference to be noticable.
hrist Jesus came into the world to save sinners, of whom I am first.(I Timothy 1:15)

For God so loved the world, that He gave His only begotten Son,
that whoever believes in Him should not perish, but have eternal life.(John 3:16)
Reply
#24
Code:
Choice$ = "abcd" + CHR$(27) + CHR$(13)
DO
     k$ = INKEY$
LOOP UNTIL (k$ <> "") * INSTR(Choice$, k$)

This one gets rid of one loop. I don't know how it measures up, speed-wise.

*peace*

Meg.
Reply
#25
Meg,
It doesn't work for me. INSTR(Choice$, "") = 1, so it doesn't wait for any key to be pressed. This makes sense mathematically. The empty string is a substring of every string, but it doesn't make sense in programming. It is just another thing you have to work around in QB.
hrist Jesus came into the world to save sinners, of whom I am first.(I Timothy 1:15)

For God so loved the world, that He gave His only begotten Son,
that whoever believes in Him should not perish, but have eternal life.(John 3:16)
Reply
#26
it works fine for me. Are you sure you got it exactly right?

if k$ = "", then (k$ <> "") = 0, so the product = 0, which is false

*peace*

Meg.
Reply
#27
Hey Meg,
"If swimming's so good for your figure, explain whales.", whats up with that, don't you find whales attractive, LOL. J/K
S VERDAD?!
Reply
#28
Whatsswimming got to do with anything
eminiscing about trapezoids in conjunction with stratospherical parabolas:

No questions asked.

www.stickskate.com
Reply
#29
:oops: Sorry Meg, I didn't read carefully :oops:
hrist Jesus came into the world to save sinners, of whom I am first.(I Timothy 1:15)

For God so loved the world, that He gave His only begotten Son,
that whoever believes in Him should not perish, but have eternal life.(John 3:16)
Reply
#30
I'm glad Meg gave us something else to talk about instead of the boring GOTO issue. You "anti-GOTO" advocates would have been happy programming in the early versions of Pascal, which had no GOTO statement at all.
*****
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)