-
Notifications
You must be signed in to change notification settings - Fork 302
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
[BUG] combining ask
with at random
does not work (level 3)
#1938
Comments
Hmm, I think this is gonna be a bit tough! A simpler program such as:
Is currently also not supported, as the text after |
Now that you mentioned this, I see that any variable does not work with
This should work from level 2 on, but doesn't. Is it too difficult to treat the text behind |
From level 4 on, we need to use quotation marks for strings we want to print with In level 4, the first example would become:
This works fine, so the problem that we cannot use variables (let alone use at random) in combination with |
Thanks for diving into this you both!! I think in general On the other hand, the |
Hi, new to open source and looking to contribute! I've been able to build and run Hedy. I'm working with a partner from my class to do an assignment that pertains to contributing to open-source. Any chance this issue is still unassigned and we can work on it? |
Yes it is still open! As you can read there was some discussion on the best path here, but I think that it would be nice to have consistency between ask and print, meaning
should indeed work. Let us know if you need any help! Since this is an issue pertaining to the Hedy language it can be a bit complex (many connected parts) but we are here to help. |
I am afraid the
The We could ignore the difference in level 2 and just add list access in level 3. But wouldn't that be confusing? |
…5362) Fixes #1938 The `ask` command now accepts the same input as the `print` command. In levels 2-3 it supports variables and list access. If the variable is defined after the command or the list is just used by name (without `at random` or `at` index), the argument is interpreted as a literal string. **How to test** Automated tests are added to cover all changes. However, to get a sense of how the change looks in Hedy, execute the following snippets in the respective level. Level 2 ``` name is Hedy answer is ask are you name? # the ask command should yield `are you Hedy?` ``` ``` answer is ask are you name? name is Hedy # the ask command should yield `are you name?` because the variable name is defined afterwards ``` ``` name is what is your name? # the name on the rhs should be a literal string and not a reference to the variable ``` Level 3 ``` animals is cat, dog, hamster answer is ask Do you have a animals at random? print Do you have a animals at random # both commands should interpret animals at random ``` ``` animals is cat, dog, hamster answer is ask Do you like animals? print Do you like animals? # both commands should not interpret animals, so it should be 'Do you like animals?' ``` ``` animals is cat, dog, hamster answer is ask Do you like animals at rand? print Do you like animals at rand? # both commands should not interpret animals, so it should be 'Do you like animals at rand?' ``` ``` c is red, green, blue color c # should yield a runtime error that the supplied value is not a color ``` ``` red is 1, 2, 3 color red # should not yield an error and should correctly show a red turtle ```
Describe the bug
When using
at random
in combination withask
, the name of the list andat random
is printed without being replaced by one of the elements of the list.Paste the Hedy code & level
In level 3
Expected behavior
The question asked becomes: What is your favourite color? (Or one of the other options in the list. )
The text was updated successfully, but these errors were encountered: