There are 20 boys and 10 girls in a class.
The teacher wants to select just one to represent the class.
One boy out of 20 can be selected in 20 ways.
Similarly, one girl out of 10 can be selected in 10 ways.
So, if he has to select either a boy OR a girl, he can do it in total 20+10 number of ways. i.e 30