If statement

Is i possible to specify an if cycle for endogenous variables ? I would like to have something like
"if w<w(-1)
w=w(-1)
else
w=…"

In the context of stochastic simulations: no.
In the context of deterministic simulations, you have to rewrite the conditions using min and max operators.

So if I have w=mrs, I have to impose w=max(mrs,x(-1))?

Yes.