Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Vertical bar
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
====Disjunction==== In many programming languages, the vertical bar is used to designate the [[Logical disjunction|logic operation ''or'']], either [[Bitwise operation|bitwise]] ''or'' or [[Boolean data type|logical]] ''or''. Specifically, in [[C (programming language)|C]] and other languages following [[C syntax]] conventions, such as [[C++]], [[Perl]], [[Java (programming language)|Java]] and [[C Sharp (programming language)|C#]], <code>a | b</code> denotes a [[Bitwise operation#OR|bitwise ''or'']]; whereas a double vertical bar <code>a || b</code> denotes a ([[Minimal evaluation|short-circuited]]) [[logical disjunction|logical ''or'']]. Since the character was originally not available in all [[code page]]s and keyboard layouts, [[ANSI C]] can transcribe it in form of the [[C trigraph|trigraph]] <code>??!</code>, which, outside string literals, is equivalent to the <code>|</code> character. In [[regular expression]] syntax, the vertical bar again indicates logical ''or'' ([[alternation (formal language theory)|alternation]]). For example: the Unix command <code>[[grep]] -E 'fu|bar'</code> matches lines containing 'fu' or 'bar'.
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)