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.

Newcomers DBPro Corner / Is this a bug?

Author
Message
Guillermo
22
Years of Service
User Offline
Joined: 15th Sep 2002
Location: United States
Posted: 16th May 2003 17:21
I have tried to include the result of a numerical variable in the text of an input statement. When I use the commands, for example:
y=24
y$=chr$(y)
print y
The computer prints 24
But when I do this:
y=24
input chr$(y)+"...",x
the result is that the screen shows
...
while it waits for input. I think the correct result should be:
24...
Am I misunderstanding the use of the chr$() command?
What should I be doing to include numerical results of variables in input commands?

Guillermo
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 16th May 2003 18:28
You need str$(y)

chr$(y) would return the character represented by ASCII code 24, which represents cancel. Cancel is not a displayable character.

Thanks in advance.
All the Best,
StevieVee
Guillermo
22
Years of Service
User Offline
Joined: 15th Sep 2002
Location: United States
Posted: 16th May 2003 18:49
Thanks!
Still, how come does it print 24 when I use the print command?

Guillermo

Richard Davey
Retired Moderator
22
Years of Service
User Offline
Joined: 30th Apr 2002
Location: On the Jupiter Probe
Posted: 16th May 2003 18:54
Because you're printing the value of y, not of y$ which is where you assigned the ASCII character to.

Cheers,

Rich

"Gentlemen, we are about to short-circuit the Universe!"
Guillermo
22
Years of Service
User Offline
Joined: 15th Sep 2002
Location: United States
Posted: 16th May 2003 19:21
Oh! How dumb! I hate to make such mistakes... Thanks!

Guillermo

Login to post a reply

Server time is: 2024-09-20 07:50:08
Your offset time is: 2024-09-20 07:50:08