With a write variable action you can assign values you provide via object flows, to a code snippet of you choise. You can add them to your diagram by clicking on Action in the toolbox, and clicking on the activity diagram afterwards while holding the CTRL key. There you can select Write Variable which will add a write variable action to your diagram.
Note that the value pin isn't shown by default. To get the value pin, right-click on the value specification and select Structural Elements... where you can select the value pin to be shown:
In this examle, we use a value specification and its result to write a new variable int a by forwarding the controlfolw to the next element and also by creating an object flow from result pin to the value pin.
Both behaviors are allowed and valid.
Object flows do not need to run in the same direction as the control flow.