Masturbation

before i go to bed i get horny sometimes but idk to handle it...so i thought of masturbation but idk really how it works. Can someone walk me through it....