When was golf invented?

Golf was invented and first played in Scotland in the 15th century.  The first 18-hole round of golf was played at St. Andrews (in Fife, Scotland) in 1764.