Skip to content

🖊️ #5910 replace echo with answer interpolation#6491

Draft
koenelsdijk wants to merge 22 commits intohedyorg:mainfrom
koenelsdijk:5910-replace-echo-with-answer-interpolation
Draft

🖊️ #5910 replace echo with answer interpolation#6491
koenelsdijk wants to merge 22 commits intohedyorg:mainfrom
koenelsdijk:5910-replace-echo-with-answer-interpolation

Conversation

@koenelsdijk
Copy link

@jpelay
This is a partial fix, but here is a draft PR.
Initially, it contains the language transpilation of the feature.
What still needs to be done, afaik:

  • fix code validation

  • fix syntax highlighting in editor

  • description, explanation in adventures (ask levels 1 & 2), docs (@MarleenGilsing ;))

  • Fixes 🖊️change 'echo' into a variable #5910

    • Allows for the use of answer as a translatable keyword to use the variable stored in the ask command
    • The value can be interpolated in strings in the print and ask commands
    • Initially implemented in level 1

How to test

Go to http://localhost:8080/hedy/1#ask_command
Run this code:

print Hello! This is about answer. 
ask What is your name?
print Hello answer!
ask How old are you, answer?
print Wow, answer is very old!

Expected output:

Hello! This is about answer. 
What is your name? # type in 'Hedy'
Hello Hedy!
How old are you, Hedy? # type '42'
Wow, 42 is very old!

@jpelay
Copy link
Member

jpelay commented Feb 13, 2026

Hello, @koenelsdijk! Thank you for the PR, @MarleenGilsing tells me you can no longer continue working on the feature and we are going to take it from here. But I have a question, can you upload the changes to the transpiler? I'm not seeing them on the changed files of the PR 🤔

@koenelsdijk
Copy link
Author

koenelsdijk commented Feb 21, 2026

Hi @jpelay, sorry for the slow response.
The transpiler changes are already here, in hedy/__init__.py in class ConvertToPython_1(ConvertToPython): https://github.com/hedyorg/hedy/pull/6491/changes#diff-fe992300672e02f245ac6f99b644631655c0f13db2c3e45f15652444ebc26850.
Or did you mean something else?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: In Progress
Status: Review for relevance

Development

Successfully merging this pull request may close these issues.

🖊️change 'echo' into a variable

2 participants