Loading [Contrib]/a11y/accessibility-menu.js

while

While loop that executes until the condition returns false.

Syntax

while (condition)
  statement
end

Inputs

condition
Anything that can be logically tested.
Note: If the value of the condition in a while statement is a vector or a matrix, it is considered true only if it is non-empty and all of the elements are non-zero.
Type: double | char | logical | struct | cell | integer
Dimension: scalar | vector | matrix

Outputs

statement
Statement to be executed if while condition returns true.

Example

Simple while example:

a=0
while a ~= 10
  a=a+1
end
a
a = 0
a = 1
a = 2
a = 3
a = 4
a = 5
a = 6
a = 7
a = 8
a = 9
a = 10
a = 10