Why don't I need a comment character after an (...) ellipsis?
Show older comments
When debugging some code, I found that the following produces the 1x4 array that one would hope for, but does not require the start of comment character %:
a = [1, 2,... why don't I need % here?
3, 4]
What is this (...) being interpreted as and are there any other characters with the same behavior?
1 Comment
Stephen23
on 15 Nov 2024
"What is this (...) being interpreted as and are there any other characters with the same behavior? "
See:
Only the ellipsis is defined to continue code execution on the next line.
"Why don't I need a comment character after an (...) ellipsis?"
Because by definition the ellipsis continues the code execution on the next line. Therefore anything that follows on the same line cannot be executable code.
Accepted Answer
More Answers (1)
Most probably there is the convention that ... is the symbol to connect two subsequent lines and that everything behind the ... appearing in the same line is ignored.
Categories
Find more on Entering Commands in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!