| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The only control flow statement Sieve has is "if" statement. In its simplest form it is:
if |
The effect of this statement is that the sequence of actions between the
curly braces is executed only if the condition evaluates to
true.
A more elaborate form of this statement allows to execute two different sets of actions depending on whether the condition is true or not:
if |
The most advanced form of the "if" statement allows to select an action depending on what condition from the set of conditions is met.
if |
There may be any number of "elsif" branches in an "if" statement. However it may have at most one "else" branch. Notes for C programmers:
Here's an example of "if" statement:
if header :contains "from" "coyote"
{
discard;
}
elsif header :contains ["subject"] ["$$$"]
{
discard;
}
else
{
fileinto "INBOX";
}
|
The following section describes in detail conditions used in "if" statements.