Scilab Website | Contribute with GitLab | Mailing list archives | ATOMS toolboxes
Scilab Online Help
6.1.0 - 日本語

Change language to:
English - 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ヘルプ >> Scilab > Control flow > elseif

elseif

if-then-elseのキーワード

説明

条件が複数ある場合,キーワードelseif が便利です. 複数のelseifがある場合, 最初にtrue条件となったものが選択されます(他のものがtrueの場合でも).

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

参照

  • if — 条件付き実行
  • select — select キーワード

履歴

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 Feb 25 08:53:17 CET 2020