Libraries‎ > ‎Library‎ > ‎Control‎ > ‎

Do if else

BehaviourComposer: ignore everything before this.
Begin micro-behaviour:
Begin description:Conditionally adds one of two lists of micro-behaviours.End description

Do if else

Begin NetLogo code:
substitute-text-area-for condition truedo-if-else (condition)  [add-behaviours        list-of-micro-behaviours "Behaviours to add if true" []]  [add-behaviours        list-of-micro-behaviours "Behaviours to add if false" []]
End NetLogo code

Variants

You can edit the condition field to any expression that can evaluate to true. You can add micro-behaviours to either list of behaviours.

How this works

This relies upon the Behaviour Composer do-if-else scheduling extensions to NetLogo to run the list of micro-behaviours if condition is true.

Related micro-behaviours

History

Do if else was implemented by Ken Kahn on 1 February 2010.

BehaviourComposer: ignore everything after this.