Info
이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.
Simple question loop for
조회 수: 1 (최근 30일)
이전 댓글 표시
Hello,
It's a very basic question because I'm new in the world of Matlab.
I want to know what happend when there is a for loop like this :
for i = 1:n
% Inside of the loop
end
but n = 0
Does it enter the loop or not at all ?
Thank you,
Laurie
댓글 수: 0
답변 (2개)
Asad (Mehrzad) Khoddam
2020년 10월 19일
You can simply add a disp command to see that nothing will be printed when n=0. It means that the statements inside the loop will not be executed.
n=0;
for i = 1:n
% test
disp(i);
% Inside of the loop
end
댓글 수: 1
이 질문은 마감되었습니다.
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!