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

Proposal: Rust-like if, while and for syntax #5042

Closed
ghost opened this issue Apr 15, 2020 · 1 comment
Closed

Proposal: Rust-like if, while and for syntax #5042

ghost opened this issue Apr 15, 2020 · 1 comment

Comments

@ghost
Copy link

ghost commented Apr 15, 2020

In my opinion, the rust-like syntax

if condition { expr }

where the {} are forced, but the () around the condition can be omitted is easier to read and write than the c-like

if (condition) expr

syntax.
I think this change would benefit zig because IMHO omitting the {} almost always makes the code more unreadable, the structure given by the {} helps really to see where the expression ends. Furthermore, when the {} are forced, the () doesn't really help here, since the condition is already well separated by the if and the {.

@emekoi
Copy link
Contributor

emekoi commented Apr 15, 2020

see #4294 and #1659.

This issue was closed.
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

1 participant