For Matlab, I need to write a program where a Gambler starts with 5 dollars and runs out with 1 dollar bets. The house has favorable odds of 70/30. I have gotten very far, but I can't find out how to end the loop when the gambler reaches 0. Here is my script: Code (Text): A = 5 n=100; x=rand(1,n); for i=1:n-1 if x(i)>0.3 A=A-1 else A=A+1 end end My script runs the 100 times and leaves me with a negative number. Everything works for the script, except ending at 0. I tried doing a while loop but it didn't work.