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

🪲 Add support for numbers in return statements #5414

Merged
merged 2 commits into from
Apr 16, 2024
Merged

🪲 Add support for numbers in return statements #5414

merged 2 commits into from
Apr 16, 2024

Conversation

boryanagoncharenko
Copy link
Collaborator

Fixes #5170
With this PR, return statements try to convert their output to integers and floats and output strings if the number conversion fails. This change is required because the output of a function cannot be used in an arithmetic operation.

How to test
Navigate to level 14 and run the following program. Ensure that it completes without an error:

define round with x
    return x

r = call round with 1
print r + 1

Copy link
Contributor

mergify bot commented Apr 16, 2024

Thank you for contributing! Your pull request is now going on the merge train (choo choo! Do not click update from main anymore, and be sure to allow changes to be pushed to your fork).

@mergify mergify bot merged commit 8021295 into main Apr 16, 2024
12 checks passed
@mergify mergify bot deleted the return_5170 branch April 16, 2024 22:29
Copy link
Contributor

mergify bot commented Apr 16, 2024

Thank you for contributing! Your pull request is now going on the merge train (choo choo! Do not click update from main anymore, and be sure to allow changes to be pushed to your fork).

@Jsgn3
Copy link

Jsgn3 commented Apr 17, 2024

I tried the example above at level 14. It ended with this error:

...
Er ging iets fout bij het uitvoeren van het programma.

While running your program the command + received the values 1 and 1 which are not allowed. Try changing the values to be all text or all numbers.
...

I ran Hedy at: https://www.hedycode.com/hedy/14#default

@boryanagoncharenko
Copy link
Collaborator Author

I tried the example above at level 14. It ended with this error:

... Er ging iets fout bij het uitvoeren van het programma.

While running your program the command + received the values 1 and 1 which are not allowed. Try changing the values to be all text or all numbers. ...

I ran Hedy at: https://www.hedycode.com/hedy/14#default

Thanks for looking into it!

Yes, the program will still fail when you try it at https://www.hedycode.com and this is normal. The reason is that the code in this pull request has been merged to the main branch but has not been deployed to https://www.hedycode.com yet. If you want to run this new version, you would have to run Hedy locally (we have great docs). Otherwise, you could wait a few days and the fix will become available at https://www.hedycode.com.

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.

Unsupported operand type(s) for +📜
3 participants