emojicode / emojicode

πŸ˜€πŸ˜œπŸ”‚ World’s only programming language that’s bursting with emojis

Home Page:https://emojicode.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Ranges Do Not Work As Expected

zoltarTheGreat opened this issue Β· comments

While writing some emojicode I ran into some unexpected behaviors with ranges of steps not equal to 1.

🏁 πŸ‡
    πŸ”‚ y πŸ†•β© 0 5 2❗️ πŸ‡
        πŸ˜€ πŸ”‘ y ❗️❗️
    πŸ‰
πŸ‰

This is a simple loop of printing the values in the range. I expected 3 digits. "0 2 4"
I only see displayed 2, "0 2"
I checked to see if this was only an interaction with loops but this code
πŸ˜€ πŸ”‘πŸ“πŸ†•β© 0 5 2❗️❓❗️❗️
returns length 2, rather than the expected 3.

In other languages such as python the range function returns different results

>>> list(range(0, 5, 2))
[0, 2, 4]

Ive tried with other numbers and I also see similar issues. I am on the most recent version of emojicode.
It must be an off by 1 error somewhere but I have not gone into the source code to investigate it.

commented

This is indeed a bug in πŸ“ as the result of the division needs to be ceiled actually:

https://github.com/emojicode/emojicode/blob/master/s/⏩.πŸ‡#L51