A fence is something built like a low wall, often made of metal or wood, to keep something in or to keep something out. It differs from a wall, which has a foundation. Fences are usually supported by fenceposts. Fences can be large or small. Many are used in gardens but some are used in different places. A fence differs from a wall in not having a solid foundation along its whole length.
Alternatives to fencing include a ditch (sometimes filled with water, forming a moat).