Info
이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.
Using the while loop function
조회 수: 1 (최근 30일)
이전 댓글 표시
How do i make a while loop to loop five times if the user does not enter the correct input?
댓글 수: 0
답변 (1개)
Pavel Osipov
2019년 10월 5일
편집: Rik
2019년 10월 5일
fa1=false;
%fa2=true;
k=0;
while k<5
k=k+1;
if fa1==false
disp('you answer is bad, try again. ');
disp('attempt = ');disp(5-k);
else
disp('you answer is good');
break;
end%if
end%while
댓글 수: 4
이 질문은 마감되었습니다.
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!