In linguistics, code-switching and borrowing are two separate entities. Code-switching occurs when a speaker of two distinct languages switches between the two in conversing with another person who also understands both languages. The phenomenon is often found in children whose language used in the home is different from the one they are required to use in school. In speaking with others, they almost unconsciously switch between languages, depending on the situation in which they find themselves at any given moment. An example of this is shown in an English-language learner who has reached a comfortable level of fluency in his second language such that he is able to communicate easily with his teachers at school in English, but still speaks Spanish exclusively at home. When he speaks to his Hispanic friends, he switches back and forth between Spanish and English, the two languages that he knows and that the recipient of his communication understands as well. The code-switching is effortless, and demonstrates a strong mastery of both languages.
Borrowing, on the other hand, is when words from another language are taken and incorporated into a given language because there is no word in that language that adequately expresses what that word represents. Examples of this include the French word cafe, which is commonly used in English to describe a small, cozy eating place, the Japanese word anime, which denotes an entire genre of animated cartoons and books, and the Spanish word pimiento, whose original meaning is pepper.