Begin micro-behaviour Begin description: Define a parameter whose value is either true or false (optionally controlled by a switch to toggle the value at run time). End description

Boolean parameter

Begin NetLogo code:
define-parameter
 
 no interface
 add switch

name: 
initial value: 

End NetLogo code

Variants

All the text areas can be changed. By clicking on the radio buttons you can choose whether the parameter should have an interface for user control and whether it should be a switch or an input box.

The Behaviour Composer can provide more support if the parameter name begins with "the-". If multiple interface elements have the same location they are placed one under another.

Related Micro-behaviours

Parameter defines parameters that can have any value.

How this works

This creates a NetLogo global variable. The global variable can optionally be controlled by a NetLogo switch or input box. Note that define-parameter is not a NetLogo command. NetLogo does not provide support for creating interface elements on the fly. Instead this adds the appropriate element to the NLOGO file. Interface elements are added at load time and cannot be added or removed later. Nor can they be repeated or scheduled.

History

Boolean parameter was implemented by Ken Kahn on 28 September 2009.