How to create variables


Learn what a variable is and how to:


A variable can be any block or parameter in the Notebook. By declaring a block as a variable, entire parts can be changed quickly and parametrically. An entire Notebook of functions can automatically be computed and rebuilt by changing values in the variable. Variables allow for quick and easy organization and understanding of your Notebook since the variable blocks don't get nested within another block. 

To create a Block variable:

    • Select the block
    • R-click along the top of the block
    • Select "Make Variable"

A block variable looks different from a regular block. The block name moves to the left and sits on top of the block color (related to the block type). Below you can see a variable vs a regular block.


A block variable never "nests" inside another block. Instead, a "chip" is created to show that the variable is inserted in that block. Watch this quick gif below to see how to create a variable, re-name it, and insert it into another block. 


To create a Parameter variable:

    • R-click over a parameter name
    • Select "Make Variable"

 A parameter variable is a useful way to quickly change a specific aspect of a block. It makes it clear what input can change. See the gif below on how a parameter variable is made.


Use the Info Panel to Create Property Variables:

    • Expand the (?) symbol on the block to open the Info Panel
    • Go to the Properties Tab
    • Drag any property into the Notebook to create a variable of that property (these properties are linked to the block they came from). You can also drag any chip directly into an input, instead of the Notebook.


Removing Variable Contents:

    • Empty a variable by R-clicking on the variable and selecting "Remove Contents"

Emptying a variable allows you to quickly change the contents of that variable while keeping the variable chip inserted as inputs in other blocks.

In this example, the contents of a Cube block variable are being removed. In order to allow any Implicit Body input, the variable block type icon needs to change from Cube to Implicit Body. To do this, click on the icon and search the list or type in the desired input type. 

Changing the Sphere and Cube into variables allows you to quickly replace them without having to R-click and remove contents. 


More on this topic:


 block variable create parameter edit what is change using info vary creating removing variables make input chip nest 
Was this article helpful?