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 i** syntax #732

Open
frc4533-lincoln opened this issue Aug 21, 2024 · 3 comments
Open

Add i** syntax #732

frc4533-lincoln opened this issue Aug 21, 2024 · 3 comments

Comments

@frc4533-lincoln
Copy link

frc4533-lincoln commented Aug 21, 2024

The i++/++i and i--/--i syntax is pretty common for adding and subtracting 1, respectively.
I'm disappointed with language designers. Has nobody thought of i**/**i syntax?

// Just look how useful it is:
var var i = 7!
print(i**!)! // => 7
print(**i!)! // => 7

I can't tell you how many times I've wanted to multiply an integer by one. I'm sick and tired of i = i * 1.

@TodePond
Copy link
Owner

this is a great idea

@fulcanelly
Copy link

fulcanelly commented Sep 13, 2024

@TodePond @frc4533-lincoln

what about // syntax ?

I find myself really tired lately of writing one or 1

it would be much more convenient if I would write just 2 // or 9 // instead

also as a shortcut for undefined since 0 // is 0 / 0 i.e undefined

@guigui0246
Copy link

also as a shortcut for undefined since 0 // is 0 / 0 i.e undefined

@fulcanelly no because 0// is 0 / 1 and therefor 0 but you could do a const const const 0 / 1 = undefined to use 0// as a shortcut to undefined

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

No branches or pull requests

4 participants