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

Typing for second variable in for #87

Open
schungx opened this issue Aug 14, 2022 · 0 comments
Open

Typing for second variable in for #87

schungx opened this issue Aug 14, 2022 · 0 comments

Comments

@schungx
Copy link
Collaborator

schungx commented Aug 14, 2022

for (n, i) in 0..10 {
    ...
}

In a for loop, the second variable (if provided), in this case i, is always int at the beginning of each iteration, so this can probably be hard-coded in.

Technically speaking we can infer the type of n from the range operator as well, but that is not 100% fool-proof.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants