if

conditional statement.

📝 Syntax

  • if conditional_expression_1, statements_1, elseif conditional_expression_2, statements_2, else statements_N end

📄 Description

if and else statements form a control structure for conditional execution.

💡 Example

i = 0;
if i == 0
  disp('ok')
elseif i == 1
  disp('not ok 1')
else
  disp('not ok 2')
end

🔗 See also

for.

🕔 History

Version
📄 Description

1.0.0

initial version

Last updated

Was this helpful?