$|\text{rank}A-\text{rank}B|\leq \text{rank}(A+B)$

I would like to prove the following inequalities:

$$|\text{rank}A-\text{rank}B|\leq \text{rank}(A+B)$$

I know that $$\text{rank}(A+B)\leq \text{rank}A + \text{rank} B,$$ but I can't tackle the problem.

Any help would be appreciated.

Thanks

We have $$\def\rank{\mathop{\rm rank}}\rank(A)=\rank((A+B)+(-B))\le\rank(A+B)+\rank(-B)\ .$$ See if you can finish it from here.