Syntax

"if" Strategy "then" Strategy "else" Strategy "end" -> Strategy

Description

  <if s1 then s2 else s3 end> t

If s1 succeeds then strategy s2 is applied. If s1 fails, then s3 is applied.

The result of condition is ignored. If the condition succeeds, then the result is

  <s2> t

If the condition fails, then the result is

  <s3> t

Formatting

The if then else construct is usally formatted in the following way:

  if s1 then
    s2
  else
    s3
  end

Implementation

The if-then-else construct is sugar for a guarded left-choice. The strategy

  if s1 then s2 else s3 end
translates into

  where(s1) < s2 + s3

Revision: r1.1 - 03 Oct 2004 - 11:33 - MartinBravenboer
Copyright © 1999-2020 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback