I have some problem understanding lambda
. My point is adding 1
to a variable in lambda until some point.
Example;
x = 0
t = lambda y: y+1
while True:
print ("Hello")
t(x)
if x==5: break
I thought it will stop after 5 times, but I realized that lambda is adding 1 only once. And this while loop is infinite. Why is that? Why lambda doesn't add 1 to that variable until while loop is finish like x += 1
?