Escape

Share

What is "Escape" in the Computer?

The term escape has multiple meanings in the computer.

Escape is a key of the keyboard: the escape key, or Esc key. Pressing escape will "escape" certain contexts, like escaping a full screen mode, or cancelling a confirmation dialog window.

In programming, to escape a text means to use certain characters called escaping characters to cancel the effect of special characters, turning them into normal, literal characters. For example, in Bash, an argument that starts with tilde (~) is automatically turned into the filepath of the home directory. We can escape the tilde with a backslash (\):

$ echo ~
/home/john

$ echo \~
~

A common use for escaping is to escape the delimiter of a literal in source code. This delimiter is usually the double quote ("). For example, in foo = "Hello world";, we have the literal text "Hello world". This isn't text code, this is just text, but it must be surrounded by double quotes. To have double quotes INSIDE the literal text, we would have escape it somehow otherwise the program that interprets this source code would think that double quote marks the end of the literal. For example: foo = "John says \"Hello.\"";.

Written by Noel Santos.

About the Author

I'm a self-taught Brazilian programmer graduated in IT from a FATEC. In a world of increasingly complex and essential computers, I decided to use my technical expertise in hardware, desktop applications, and web technologies to create an informative resource to make PC's easier to understand.

View Comments