let

let variable value

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 ] ]

Take me to the full NetLogo Dictionary