Creates a new local variable and gives it the given value. A local variable is one that exists only within the enclosing block of commands.
If you want to change the value afterwards, use set.
Example:
let prey one-of sheep-here if prey != nobody [ ask prey [ die ] ]
You can also create multiple local variables if you put the variable names in a list format. The values for the new variables will be taken from the list given as the second argument. This can be particular useful when you want to calculate multiple values in a reporter procedure, as you can easily create multiple variables with the results. A runtime error will occur if you do not give a list of values or the list you provide doesn't have enough values for all the variables.
let [x y z] [10 15 20] show x ; prints 10 show y ; prints 15 show z ; prints 20 let [a b c] [10] ; causes a runtime error as we need at least 3 values in the list
Take me to the full NetLogo Dictionary