CASE

From ASCEND
Jump to: navigation, search

The CASE statement is used within WHEN, SWITCH and SELECT blocks. These all handle modeling alternatives within a single definition. The easy way to remember the difference is that

  • WHEN picks which equations to solve when discrete variables have certain values
  • SELECT selects which statements to compile based on discrete constants.
  • SWITCH statements handle flow of control in methods, in a slightly more generalized form than the C language switch statement.

See also conditional modelling, OTHERWISE.