Описание тега backslash

The backslash character \ (not to be confused with slash /) is used in many languages to quote the next character, i.e. to make it lose its special meaning. It is also the directory separator in file paths under DOS and Windows.

The backslash character \ is a mirror version of the slash character /, created for use in computing. Its meaning depends on the context.

  • In many languages, \ followed by a character that has a special meaning makes the next character lose its special meaning. This is especially true inside string literals string-literals and regular expressions regex: for example, in many languages, "a\\b\"" represents the 4-character string a\b".
  • Sometimes \ gives the next character a special meaning. This is mostly the case when \ is followed by a letter or digit in a string literal, where it can be used to specify a control character or other special character. For example, \n specifies a newline in many languages, and \123 often specifies the character whose octal value is 123 (but note that some languages have different rules).
  • In DOS dos and Windows windows, the \ character is the directory (folder) separator in file paths. For example, c:\windows\cmd.exe is the file called cmd.exe in the directory called windows at the root of the c: drive.
  • In (La)TeX tex latex, \ starts a command name.
  • In Haskell haskell, \ introduces a lambda expression lambda.