Learning IF statements and variables
In this section, we will learn more about if
statements and variables. Before we re-open Dynamo, let's talk about those two things for a moment. Variables are the easiest to understand. In computer science, variables are data items that don't have a fixed value, as you may already know. Sometimes, variables are used because they make our life a bit easier. Especially when we are coding something, we can't use var1
, var2
, all the way to var100
. It would be madness. Instead, we want to use variables to communicate their scope, not only to us, but also to colleagues and peers who may work on our scripts in the future. Let's say we need to develop a script that has to update the window's width. We want to calculate the width of the windows by using variables such as the following:
window_width_default
window_width_calculated
Those variable names aren't perfect, but they communicate their purpose pretty...