sum-of-turtles-with pred-ilist ilist
Reports the total value of ilist when run over the turtles that satisfy pred-ilist . If there are no turtles in which pred-ilist is true, returns 0. Note: This command can also be executed by patches, for example within an ask-patches statement. Example: sum-of-turtles-with (color = red) [age] returns the sum of the ages of all the red turtles.
Related commands:
|