-
Notifications
You must be signed in to change notification settings - Fork 94
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
[Feature] Declaring empty variables #420
Comments
How about:
|
That looks even better |
it should also throw a compile error if the user tries to read from it before it was assigned |
I don't think this issue brings in any useful value. What would be the biggest benefit of the ability to declare a variable without it's default value? I think that this feature makes sense only when we introduce more advanced data types. If you agree I'll close this issue for now. It can be always reopened |
Is your feature request related to a problem? Please describe.
In bash, it is possible to declare an empty variable, like so:
Outputs:
However, this functionality is not present in Amber:
Outputs:
Describe the solution you’d like
Simply, compile
let foo
todeclare foo
.Additionally,
declare
is useful for enforcing variable type, as demonstrated in this stackexchange answer. This could be written in Amber aslet foo = Text
.Describe alternatives you’ve considered
I suppose writing
let foo = ""
would suffice, but my proposed solution implements more bash functionality and allows for cleaner Amber code.The text was updated successfully, but these errors were encountered: