Skip to content

If Then Else

Definition

<if>
    <proposition .../>
    <then>
        ...
    </then>
    <else>
    ...
    </else>
</if>

An if then else element for branching plans. The if element can be used recursively. Both the then and else elements are optional (but to be meaningful at least one is needed).

Parents

Children

Behaviour

Examples

If/Then/Else element for jumping to another goal if there is a proposition in commitments with a certain predicate

<if>
  <has_shared_value predicate="sourdough_status"/>
  <then>
    <jumpto action="freshen_up_sourdough"/>
  </then>
  <else>
    <jumpto action="start_sourdough"/>
  </else>
</if>

If/Then element for assuming the answer "200 g" if the selected ingredient is water

<if>
  <is_shared_commitment predicate="selected_ingredient" value="water_ingredient"/>
  <then>
    <assume_system_belief>
      <proposition predicate="quantity" value="200 g"/>
    </assume_system_belief>
  </then>
</if>

If/Then element for assuming the answer "200 g" if the selected ingredient is water (either in commitments or in beliefs)

<if>
  <proposition predicate="selected_ingredient" value="water_ingredient"/>
  <then>
    <assume_system_belief>
      <proposition predicate="quantity" value="200 g"/>
    </assume_system_belief>
  </then>
</if>

Last update: October 25, 2022