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

🪲 code in french generating an error 'string index out of range' #5341

Closed
etienneCharignon opened this issue Mar 31, 2024 · 0 comments · Fixed by #5352
Closed

🪲 code in french generating an error 'string index out of range' #5341

etienneCharignon opened this issue Mar 31, 2024 · 0 comments · Fixed by #5352
Assignees
Labels
bug Something isn't working

Comments

@etienneCharignon
Copy link
Contributor

Describe the bug

Here below is a code for level 12 that should be working. If you enter that code, then run it and ask for an étoile of color 'rouge' it generates a 'String index out of range' error.
However, if you replace the = signs of the three last si with est it then works. It's also the case, if you replace, in the last if, the word 'étoile' by 'etoile' (without the accentuated character)

Paste the Hedy code & level
The following code should run at level 12.

définis dessine_un_carré
    répète 4 fois
        avance 20
        tourne 90
    avance 20

définis dessine_un_triangle
    répète 3 fois
        avance 20
        tourne 120
    avance 20

définis dessine_un_étoile
    répète 5 fois
        avance 20
        tourne 144
    avance 20

couleur blanc
tourne -90
avance 300
tourne 180

pour i dans intervalle 1 à 5
    couleur gris
    avance 100
    forme = demande "Quelle forme veux-tu ensuite dans ton bracelet ?"
    couleur = demande "Dans quelle couleur ?"
    couleur couleur
    si forme = "carré"
        appelle dessine_un_carré
    si forme = "triangle"
        appelle dessine_un_triangle
    si forme = "étoile"
        appelle dessine_un_étoile

Add a screenshot (optional)
Capture d’écran 2024-03-31 à 17 29 53

What machine and browser you were using (optional)
If the issue concerns things in the website, let us know:

  • What computer you are using : Mac
  • What browser you were using : Firefox
@etienneCharignon etienneCharignon added the bug Something isn't working label Mar 31, 2024
@Felienne Felienne changed the title 🪲 code in french generating an error 'string index out of range' for no apparent reason 🪲 code in french generating an error 'string index out of range' Apr 3, 2024
@mergify mergify bot closed this as completed in #5352 Apr 3, 2024
mergify bot pushed a commit that referenced this issue Apr 3, 2024
…5352)

Fixes  #5341 
The prefix function convert_numerals now has support for empty strings and None values.

**How to test**
Run Hedy locally and navigate to level 12 and run:
```
for i in range 1 to 3
    form = ask "What form?"
    color = ask "What color?"
    if form is 'test'
        print 'test'
```
Once the program is running do the following:
1. Supply any value to the first input, e.g. `a`
2. Supply any color to the second input, e.g. `red`
3. Cancel the program by clicking the 'Stop program' red button
4. Start the program again
5. Supply any value to the first input, e.g. `b`
6. Supply any color to the second input, e.g. `red`
7. Check that there is no 'string index out of range' error
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: No status
Development

Successfully merging a pull request may close this issue.

2 participants