We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
I was refactoring a function and found some weirdness with if/elsebranches in afor` loop.
if
branches in a
In the playground, this outputs nothing.
my_arr = [4,5,6,7,8] what_i_found = find_6_or_7(my_arr) print 'Found: {what_i_found}' func find_6_or_7(an_arr): for an_arr each item: if item == 6: return 6 else item == 7: return 7
But if I change the else to a second if, it runs as expected:
else
my_arr = [4,5,6,7,8] what_i_found = find_6_or_7(my_arr) print 'Found: {what_i_found}' func find_6_or_7(an_arr): for an_arr each item: if item == 6: return 6 if item == 7: return 7
Using 2 ifs in this particular example isn't any less efficient than a if and else, but I think there are cases where it would be.
This time, I checked: I use all spaces for indents here.
The text was updated successfully, but these errors were encountered:
This should be fixed in 3343587.
Sorry, something went wrong.
No branches or pull requests
I was refactoring a function and found some weirdness with
if
/elsebranches in a
for` loop.In the playground, this outputs nothing.
But if I change the
else
to a secondif
, it runs as expected:Using 2
if
s in this particular example isn't any less efficient than aif
andelse
, but I think there are cases where it would be.This time, I checked: I use all spaces for indents here.
The text was updated successfully, but these errors were encountered: