I have 3 global variables:
Acurrent
Bincome
Cmax
Global variable "Acurrent" have 300
Global variable "Cmax" have 500
Global variable "Bincome" will be have random number lets for example set to 400
now when i click button
system should fill "Cmax" to his maximum variable (500)
Add "Bincome" (400) to "Acurrent"(300)
BUT when "Acurrent" is 300 we can add only 200 from "Bincome"
so finally after clicking button
we should have calculation
A-500
C-500
B-200
SECOND EXAMPLE
when Cmax have only 50
and Acurrent have 0
We take from Bincome only 50