Integrating over a genral region (multivariable)

For integrating over type 1 and type 2 regions, why does the g(x) or g(y) bound have to be the inner integral? Thanks!

HallsofIvy
$$\int_R\int f(x,y)dy$$