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

Correct example so it actually works in the web repl #94

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

JamesNewton
Copy link

No description provided.

@gchiu
Copy link
Collaborator

gchiu commented May 2, 2021

this is better

sum: 0
loop 5 [
   x: ask ["Enter a value:" integer!]
   sum: me + x
]
print ["The sum was" sum]

@hostilefork
Copy link
Owner

hostilefork commented May 3, 2021

It seems you've rediscovered a bug in the current JavaScript "fake" terminal code... its READ-LINE implementation won't work if it has to create a new div (e.g. if it happens before any PRINTs in the currently executing command.)

As Graham points out, it's probably nicer for the example to point out a niftier usage of the ASK dialect. But the ASK dialect isn't really designed yet:

https://forum.rebol.info/t/improving-the-ask-dialect-and-replacing-input/1124

Either way, ASK INTEGER! should work. The best answer here is probably to fix it, but make the example fancier as well.

For the curious, here is the source code for the current ASK in %mezz-files.r

@hostilefork hostilefork closed this May 3, 2021
Repository owner deleted a comment from JamesNewton May 3, 2021
Repository owner deleted a comment from JamesNewton May 3, 2021
@hostilefork hostilefork reopened this May 3, 2021
@hostilefork hostilefork self-assigned this May 3, 2021
@hostilefork hostilefork requested a review from gchiu May 3, 2021 20:08
@hostilefork hostilefork marked this pull request as draft May 3, 2021 20:15
@hostilefork hostilefork removed the request for review from gchiu May 3, 2021 21:03
@hostilefork hostilefork force-pushed the master branch 6 times, most recently from 6d50a7b to f356339 Compare November 28, 2021 18:01
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

Successfully merging this pull request may close these issues.

3 participants