Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Different INPUT behavior comparing to QBasic or QB64 #34

Closed
afbytes opened this issue Aug 10, 2022 · 2 comments
Closed

Different INPUT behavior comparing to QBasic or QB64 #34

afbytes opened this issue Aug 10, 2022 · 2 comments

Comments

@afbytes
Copy link

afbytes commented Aug 10, 2022

The results of running the following piece of code on QBasic and QBJS are different.

INPUT "Enter a number: ", x
 
x = x + 5
PRINT "X is now: "; x

Regards to QBasic,

  • it considers x as a number instead of a string;
    • note: if you use a variable name x$, then it will accept a string.
  • if you input "abc" and press ENTER, it will prompt you with Redo from start and ask you to input again;
    • note: empty strings are allowed.

Regards to QBJS,

  • it considers variable x as a string;
  • when user input "abc", the PRINT result will be abc5.

This issue may be related to #33.

@boxgaming
Copy link
Owner

Thanks for reporting the issue @afbytes! I've added it to the list for the next release. You can see the list of what is being worked on next on the Roadmap page in the wiki.

@boxgaming
Copy link
Owner

Hi @afbytes, this issue has been resolved as of 0.6.0. The input method will now convert the entered value to the appropriate type. At present it is still required to declare your variables for this to work properly. Support for implicit variable declaration is planned for a future release. The following will now work as expected:

DIM x
INPUT "Enter a number: ", x
 
x = x + 5
PRINT "X is now: "; x

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants