Bean shell preprocessor in Jmeter

Let us say in a particular test plan we define variale named Quantity and give it value of 10 .

Then we have a request that uses the value from test plan.

But we add a bean shell pre-processor to the that request

And and the pre-processor we type in it the following code.

oldQuan = vars.get("Quantity");
newQuan = Integer.parseInt(oldQuan)+20;
vars.put("Quantity",newQuan.toString());
print("The updated Qaun is "+ vars.get("Quantity"));

So it means change the value of variable Quantity from test plan from 10 to 30.As Bean shell pre-processor will run before the given request to which it is added so the value if Quanity will now be 30.We can check it by going to result tree.