created: 20201004154413968 modified: 20201006181831622 tags: [[Operator Examples]] [[reduce Operator]] title: reduce Operator (Examples) type: text/vnd.tiddlywiki \define add-price() [get[price]multiply{!!quantity}add] \define num-items() [get[quantity]add] \define display-variable(name) ''<$text text=<<__name__>>/>'': <$text text={{{ [<__name__>getvariable[]] }}}/> \end These examples use the following predefined variables: * <> * <> They also use the following data tiddlers:
    <$list filter="[tag[shopping]!has[draft.of]]">
  • ''<$link><$text text=<>/>'' quantity: <$text text={{!!quantity}}/>, price: <$text text={{!!price}}/>
Number of items: <<.operator-example 1 "[tag[shopping]reduce]">> Total price: <<.operator-example 2 "[tag[shopping]reduce]">>