Scilab Website | Contribute with GitLab | Mailing list archives | ATOMS toolboxes
Scilab Online Help
5.3.2 - English

Change language to:
Français - 日本語 - Português

Please note that the recommended version of Scilab is 2025.0.0. This page might be outdated.
See the recommended documentation of this function

Scilab help >> Scilab > Scilab keywords > select

select

select keyword

Description

select expr,
  case expr1 then instructions1,
  case expr2 then instructions2,
  ...
  case exprn then instructionsn,
  [else instructions],
end

Notes:

  • The only constraint is that each "then" keyword must be on the same line line as corresponding "case" keyword.

  • The keyword "then" can be replaced by a carriage return or a comma. instructions1 are executed if expr1=expr, etc.

Warning: the number of characters used to define the body of any conditionnal instruction (if while for or select/case) must be limited to 16k.

Examples

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

See Also

  • if — conditional execution
  • while — while keyword
  • for — language keyword for loops
<< return Scilab keywords semicolon (;) >>

Copyright (c) 2022-2024 (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:
Thu May 12 11:44:07 CEST 2011