Main Content

semicolon, ;

Command and array separator

Syntax

Description

The semicolon symbol (;) suppresses output of a single command, separates multiple commands on the same line while suppressing output, and also denotes the end of a row when creating an array. For instance, [12 13; 14 15] uses a semicolon to specify the end of a row in an array.

example

Examples

expand all

Use semicolons to suppress output in a function call.

X = 1:10;
Y = max(X);

You also can use semicolons to separate multiple commands on the same line while suppressing output. Alternatively, use commas to separate multiple commands on the same line and show output.

A = 2; B = 3; C = A*B;

Use semicolons to separate the rows in an array.

A = [1 2; 3 4; 5 6]
A = 3×2

     1     2
     3     4
     5     6

Version History

Introduced before R2006a

See Also

|