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


elseif

keyword in if-then-else

Description

If there is more than one condition then keyword elseif is useful. If there is more than one elseif then the first true condition is selected (even other also are true).

Examples

a=1;
if a==1 then
    disp("a equals 1")
elseif a==2 then
    disp("a equals 2")
elseif a==1 & a>0 then
    disp("this condition is true, but never will be selected, because it is the second true condition.")
else
    disp("Case not handled.")
end

See also

  • if — keyword for conditional execution
  • select — select keyword

History

VersionDescription
6.0.0 elseif is now protected: Assignments like elseif=1 are no longer possible.
Report an issue
<< else Control flow end >>

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:
Tue Oct 24 14:30:01 CEST 2023