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 件のコメント

Guillaume
Guillaume 2018 年 7 月 12 日
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 ExchangeEntering 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