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 comentario

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

Iniciar sesión para comentar.

Respuestas (2)

KSSV
KSSV el 12 de Jul. de 2018
Editada: KSSV el 12 de Jul. de 2018
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 el 12 de Jul. de 2018
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.

Categorías

Más información sobre Entering Commands en Centro de ayuda y File Exchange.

Preguntada:

el 12 de Jul. de 2018

Comentada:

el 12 de Jul. de 2018

Community Treasure Hunt

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

Start Hunting!

Translated by