Salary Component with variable declariation and complex if logic

How do implement this on a component

base = 200
x = 0
if (base <300){
x += 300
base = 0.1 * base

}

if (base < 600){
x +=600
base = 0.1 * base
}

Value of base will now be the component