Lots of courts on either side of the Royal mile, most of them called closes. As the walled city filled up with people coming in from the sticks to a better (?) life, the demand for housing meant that first of all high tenements were built fronting the main streets, then the gardens behind them filled up with more housing. The middle floors were occupied by the gentry, the ground floor by tradesmen, and the attics and cellars by the working class, or lower.
This continued until toward the end of the 18th Century, when the Old Town was stuffed full, of all levels of society. The gutters of the broad High Street (renowned for having two gutters, not the usual single one in the middle of the road) emptied down the route of least resistance - the closes on either side - which became open sewers taking refuse and rainwater down to the stinking lochs at either side.
This was no longer acceptable to the better-off, and the elegant New Town that was just being built became the place to move to, leaving the Old Town to the hoi polloi.