I have this code in matlab, it's very simple, but for some odd reason not working:
h = 0.01;
h0 = 0;
while 1
h0 = h0 + h;
if h0 == 1.000;
display('nice')
break;
end
end
The point is for h0 to keep increasing by 0.01, and the if statement checks if h0 is 1 everytime. Once it is 1, the loop should be ended. The issue is that once h0 finally is 1, the if statement is not entered.
I tried changing the if condition to a bunch of different values, such as 0.04,or 0.1. I found it also doesn't work for 0.06, and anything over 0.1.
I have no clue why this isn't working, it's a simple if statement and should work.