<< try Control flow Configuration >>

Scilab Help >> Scilab > Control flow > while

while

palavra-chave da estrutura while (significa "enquanto...")

Descrição

while . Deve ser terminado por "end"

while expressão ,instruções1,...[,else instruções], end

while expressão do instruções1,...[,else instruções], end

while expressão then instruções1,...[,else instruções], end

Notas:

According to the Code Conventions for the Scilab Programming Language it is recommended:

For example, use:

i = 0;
while i<5
    disp(i);
    i = i + 1;
end

rather than

i = 0; while i<5, disp(i), i = i + 1; end
O número de caracateres usados para definir o corpo de qualquer estrutura condicional (if while for ou select/case) deve ser limitado a 16k.

Exemplos

e=1; a=1; k=1;
while norm(a-(a+e),1) > %eps,
    e=e/2;
    k=k+1;
end
e,k

Ver Também

Histórico

VersionDescription
6.0.0
  • The [,else instructions] syntax is no longer supported.
  • while is now protected: Assignments like while=1 are no longer possible.

Report an issue
<< try Control flow Configuration >>