The definition of a code is a set of rules or a system of communication, often with randomly assigned numbers and letters given specific meanings. An example of code is the state’s vehicle laws . An example of code is a made up language that two children use to speak to each other.