A code is a way of changing information into something else. Sometimes this is done as a way of keeping a message secret. This is called cryptography. One source gives this explanation: a code is "a word, number or some other symbol used to represent a word, phrase or syllable in plaintext". It is one of the earliest forms of cryptography. Contrast code with cypher, in which the individual letters are encrypted (changed).
Sometimes it is done as an easier way of sending a message. For example, when people on two different boats want to send a message, they may be too far away from each other to talk, but they can send messages with a flag code. Another code that people use a lot is called Morse Code, which changes letters to dots and dashes, like this:
Computers use codes, by changing letters into 1's and 0's. This is called an ASCII code.
Some people write codes as a kind of game. They think it is fun to make codes, and fun to break codes. Breaking a code is called cryptanalysis. It means taking it apart to understand how it works, and then you can understand messages that are written in that code.
In the United States, there is an organization called the NSA. Their job is to break other people's codes, and to make codes that the United States government can use, which are hard to break.