Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / ASC(String) Difficulties.

Author
Message
Nilrem
23
Years of Service
User Offline
Joined: 27th Feb 2003
Location: United Kingdom
Posted: 10th May 2003 16:44
Can anyone tell me why the below doesn't work properly?
I Type Y and hit enter and it says that was not Y or N, same when pressing N (I could do a workaround using scancode or inkey$ I suppose, but I wanted to use the ASC(string) command (First time using it).
I hear and I forget. I see and I remember. I do and I understand.
Andy Igoe
23
Years of Service
User Offline
Joined: 6th Oct 2002
Location: United Kingdom
Posted: 10th May 2003 16:52
My first thoughts on looking are that is you have the wrong ASCII values, recalling from memory lower case a is 32...

run this:
print "y: "+str$(asc("y"))
print "Y: "+str$(asc("Y"))
print "n: "+str$(asc("n"))
print "N: "+str$(asc("N"))
wait key

Pneumatic Dryll
David T
Retired Moderator
23
Years of Service
User Offline
Joined: 27th Aug 2002
Location: England
Posted: 10th May 2003 16:52


I think this does what you want, and is much simpler.

You are the th person to view this signature.
Programmers don't die, they just Gosub without return....
David T
Retired Moderator
23
Years of Service
User Offline
Joined: 27th Aug 2002
Location: England
Posted: 10th May 2003 16:54
This in in function form, and is easier to use:



You are the th person to view this signature.
Programmers don't die, they just Gosub without return....
Nilrem
23
Years of Service
User Offline
Joined: 27th Feb 2003
Location: United Kingdom
Posted: 10th May 2003 17:18
Yeh, thankyou, that is simpler, I have thrown in EXIT1$ = UPPER$(EXIT1$) just to cut down on the if and, or, etc statements.

I hear and I forget. I see and I remember. I do and I understand.

Login to post a reply

Server time is: 2026-07-11 13:57:33
Your offset time is: 2026-07-11 13:57:33