Egyptian Brackets

Why Trust Techopedia

What Does Egyptian Brackets Mean?

“Egyptian brackets” is an IT slang term for situations where
programmers include a curly bracket that contains a function at the end of a
code line after the function name, arguments, conditional statements or
anything else that precedes the actual function code. The second curly bracket
is located on its own line of code, underneath the last line of code contained
in the function. This results in the first bracket being situated above and to
the right of the second bracket, which in a general sense mimics the construction
of a conventional Egyptian hieroglyphic showing a dancer. For this reason, this
code layout convention is called “Egyptian brackets.”

Advertisements

Techopedia Explains Egyptian Brackets

Egyptian brackets are also called K&R C style, named for
programmers Brian Kernighan and Dennis Ritchie who supposedly pioneered this
style in the 1970s. The use of Egyptian brackets goes to the heart of how
coders determine how to structure function code. One might think that the more
common convention would be to include both curly brackets on one line, with the
code in the middle. However, it is far more common for programmers to include
each curly bracket on a separate line, so that both brackets sit at the far
left of the screen. Critics call this poor layout and point to the overuse of
code lines, but others contend that having the brackets on the left and on
their own lines makes code more readable and enhances its aesthetic.

Advertisements

Related Terms

Margaret Rouse
Technology Specialist
Margaret Rouse
Technology Specialist

Margaret is an award-winning writer and educator known for her ability to explain complex technical topics to a non-technical business audience. Over the past twenty years, her IT definitions have been published by Que in an encyclopedia of technology terms and cited in articles in the New York Times, Time Magazine, USA Today, ZDNet, PC Magazine, and Discovery Magazine. She joined Techopedia in 2011. Margaret’s idea of ​​a fun day is to help IT and business professionals to learn to speak each other’s highly specialized languages.