Turtle and Observer Command
sum-of-patches-with pred-ilist ilist

Reports the total value of ilist when run over the turtles that statisfy pred-ilist. If there are no patches in which pred-ilist is true, reports 0. Note: This command can also be executed by patches, for example within an ask-patches statement.
Example: sum-of-patches-with (pc = green or pc = blue) [density] returns the sum of the densities of all patches which are blue or green.

Related commands: