Scilab Website | Contribute with GitLab | Mailing list archives | ATOMS toolboxes
Scilab Online Help
2023.0.0 - Português


select

Palavra-chave da estrutura select (significa "selecionar (de acordo com a variável)")

Seqüência de Chamamento

select variável
case valor_1 then
    instruções_1
case valor_2 then
    instruções_2
    ...
case valor_n then
    instruções_n
[else
     instruções]
end

Descrição

Notas:

  • A única restrição é de que a palavra-chave "then" deve estar na mesma linha que a palavra-chave "case" correspondente.

  • A palavra-chave "then" pode ser substituída por uma vírgula ou um retorno de carro. instruções_i são executadas se variável == valor_i.

Aviso: o número de caracteres usados para definir o corpo de qualquer instrução condicional (if while for ou select/case) deve ser limitado a 16k.

Exemplos

while %t do
  n=round(10*rand(1,1))
  select n
  case 0 then
    disp(0)
  case 1 then
    disp(1)
  else
    break
  end
end

Ver Também

Histórico

VersionDescription
6.0.0 select is now protected: Assignments like select=1 are no longer possible.
Report an issue
<< return Control flow then >>

Copyright (c) 2022-2023 (Dassault Systèmes)
Copyright (c) 2017-2022 (ESI Group)
Copyright (c) 2011-2017 (Scilab Enterprises)
Copyright (c) 1989-2012 (INRIA)
Copyright (c) 1989-2007 (ENPC)
with contributors
Last updated:
Mon Mar 27 09:49:51 GMT 2023