Taking Input with getProperty

The getProperty() command allows you to get the current value of design element properties. Like setProperty(), its first input is the id of a design element and the second is a property of that element. Unlike setProperty(), the getProperty() command has no third input.

You can use this command on any design element, but it's particularly useful when used with the Text Input, Dropdown, Checkbox, Radio Button, and Slider elements. These elements allow the user to change their value, and by using getProperty() you can write programs that take advantage of that user input.

getProperty Example

In this example, we're using getProperty() to take input from a Text Input, Dropdown, and Checkbox. While this example records these values to the console, you could also save them to variables or use setProperty() to change other design elements based on these values.

Found a bug in the documentation? Let us know at documentation@code.org