One of the most important properties of a convex function is that a local optimum is also a global optimum. This paper explores the discrete analogue of this property. We consider arbitrary locality in a discrete space and the corresponding local optimum of a function over the discrete space. We introduce the corresponding notion of discrete convexity and show that the local optimum of a function satisfying the discrete convexity is also a global optimum. The special cases include discretely-convex, integrally-convex, M-convex, $\text{M}^\natural$-convex, L-convex, and $\text{L}^\natural$-convex functions.