What difference if we deleted the semi-colon (;) in while loop?

What difference would we notice if we deleted the semi-colon (;) from the end of the line x = x ∗ 2?

댓글 수: 1

I'm curious, why didn't you try it? You would have seen the difference immediately.

댓글을 달려면 로그인하십시오.

답변 (2개)

KSSV
KSSV 2018년 7월 12일
편집: KSSV 2018년 7월 12일

1 개 추천

Simple...every time the output will be printed on the screen. It will be annoying and your code spents extra time to print it. ; will terminate the output print on the screen.
This you can check on your own...
Akshay Srivastava
Akshay Srivastava 2018년 7월 12일

1 개 추천

The semi-colon(;) is use to restrict the output being shown every time on the Command Window when your code runs. Thus, there will be no difference in the answer but the intermediate step will always be seen.

카테고리

도움말 센터File Exchange에서 Entering Commands에 대해 자세히 알아보기

질문:

2018년 7월 12일

댓글:

2018년 7월 12일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by