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

Increment operators like x++ and ++x #141

Open
defaultzone opened this issue Dec 8, 2023 · 1 comment
Open

Increment operators like x++ and ++x #141

defaultzone opened this issue Dec 8, 2023 · 1 comment
Labels
enhancement New feature or request experimental The changes may break something or be a bad idea

Comments

@defaultzone
Copy link

defaultzone commented Dec 8, 2023

To increment number in Clue we using

x += 1

But it's ugly(imho), it's rather to use increment operators since it can shorten many lines of code, for example:

// Can replace this by single line: print(tbl[++x])
x += 1
print(tbl[x])

Can implement in Clue like this:

Clue:

print(x++)
print(++x)

Lua:

print(x)    -- x++
x = x + 1   -- x++
x = x + 1   -- ++x
print(x)    -- ++x
@Maiori44
Copy link
Member

Maiori44 commented Dec 8, 2023

I have been reluctant in the past to add this because it can easily lead to confusing/bad code.
Many don't even know how it really works and just think it's syntax sugar for x += 1.

@Maiori44 Maiori44 added enhancement New feature or request experimental The changes may break something or be a bad idea labels Dec 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request experimental The changes may break something or be a bad idea
Projects
None yet
Development

No branches or pull requests

2 participants