-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
[BUG] 0! == 0
#3360
Comments
There are two other curious repros. fn main():
var r = 0
@parameter
for _ in range(10):
r = 0
print(r) # prints 140726121024432 But the following, which should be semantically equivalent, works just fine. fn main():
var r = 0
@parameter
for i in range(10):
@parameter
if i == i:
r = 0
print(r) # prints 0 |
Is the issue exclusive to fn main():
for i in range(10):
Can you reproduce those examples in other contexts outside of |
Ah, I agree that the empty body of the |
|
Original reproduction still gives |
Bug description
I've noticed a few weird bugs and discrepancies with for loops.
In this case, I'm using a factorial loop
fac()
, evaluated at0
, which should give1
, but instead gives0
.Toggling any one of the comments in the example will fix it.
Steps to reproduce
System information
The text was updated successfully, but these errors were encountered: