Geometry = [Imperative] what this means?

I was recently going through Dynamo language guide and i came along a script line says :
geometry = [imperative]
can anyone please explain what this stands for?

1 Like

Hello Roy,

It stipulates to the DesignScript engine that you are switching from the default associative computation methodology to imperative.

In this case, it is wrapping up all of the subsequent code inside of curley braces and executing imperatively.

In very simple terms, you use Imperative to loop inside of DesignScript.

If you wish to read more, there is a link here:

Please note that this document will be less relevant inside of Dynamo 2.0 as there have been some fundamental DesignScript language changes as documented in


In simplistic terms:

You are changing the way the compiler executes your code.

Imperative execution is performed line-by-line, and the state of a variable will not update if one of its dependencies changes later in the program.

Associative (which is the default behaviour of DS) on the other-hand, does the opposite, and will update a variable anywhere in the program if one of its dependencies change.

This is best explained through an example:

a = 10
b = 2
c = a + b
a = 3

The value of a and c with the different execution methods:

Imperative: a = 3 and c = 12
Associative: a = 3 and c = 5

In associative, c gets updated as its dependent on a (so 3 + 2) even though the change to a occurs after c is declared. In imperative, c is not updated when a updates as it doesn’t check the state of a variables associations once its declared; think of imperative kind of like ‘on-demand’ execution. This principle is why statements such as for loops and if’s have to be declared within an imperative scope, since associative changes would result in inconsistent and unpredictable program states.


@Thomas_Mahon was much more eloquent in his response than me! However, one addition to note, as per my previous link, some behaviour has changed between the 1.X and 2.X versions of Dynamo.

The code example Thomas gives above is entirely valid in 1.X but is no longer supported in 2.X. It’s a great example to illustrate the concept, just be careful not to get tripped up inside of the execution :slight_smile: