MATLAB: While loop stops before end conditions are met

if elsewhile

I have if statements inside of a while loop. If the if statement is true, the end condition updates and stops the loop. My issue is that my while loop is ending after the first loop even when the if statement that updates the end condition isn't true.
I'm not sure how to include the code as it has several functions nested for the if statements, but here's my base format.
while a~=0 && b~=0
if x = 0
a = 0
-if y = 0
-b = 0
-end
-end
My code updates of course to make the end condition reachable, but it ends after the first loop regardless.
Thanks

Best Answer

if y = 0
is not a comparison, it is an assignment.