'how to use to-report in multiple procedures in netlogo
I'm writing a NetLogo program and I'm facing an issue.
I have 'to-report' the procedure and it reports a value. In this report, I take input from the user. But I want to use the reported value(output) in multiple other procedures.
to-report initial-goat
let goats-number read-from-string user-input "How many goats are there ?"
while [goats-number > 100] [set goats-number read-from-string user-input "Please enter a value below or equal to 100 "]
report goats-number
end
to goat-create
create-turtles initial-goat
end
to calculate
let x initial-goat
let alive count turtles
let dead (x - alive)
end
Here when I use the procedures to calculate and goat-create the program asks the user two times to give input. how to avoid this? thanks. best regards,
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
