The term 'age of consent' means the age at which a person is legally allowed to decide to have sex. Sex includes oral sex or masturbating each other.
In Scotland, the age of consent is 16 for sex whether straight (guy on girl) or gay (guy on guy or girl on girl). If either person is under 16, then the person over 16 is breaking the law.
Sex between two people aged 13-15 is considered in law to be an offence even if they both consent (give permission). People under 13 are not legally able to give consent and anyone having sex with someone under 13 could be sentenced to life in prison.
The rules are different if one partner is or has been in a position of trust over the other.
If you are under 18 and you want to find out more about sex and the law visit The LowDown.