Brackets, braces, parenthesis, oh my!
Feb
19
Written by:
Thursday, February 19, 2009 10:12 PM
When someone tells you to put in a brace in your code, do you know if they're talking about ( or { or [ or even <? Read on for some concrete definitions.
With C# growing up from it's C/C++ roots, it seems natural for it to have semicolons. And there's also all the brackets, parenthesis, and braces! But do you know the technical differences between them? I'm always forgetting, so here's my permenant reminder for myself (as long as my server stays turned on that is :>).
?
|
Term
|
AKA
|
Uses
|
( xyz )
|
Parenthesis
|
|
- method calls (outgoing or incoming) to pass parameters
- order of precedence
|
[ xyz ]
|
Brackets
|
Box Brackets or Square Brackets
|
- arrays
- attributes (.NET languages)
|
{ xyz }
|
Braces
|
Curley Brackets
|
- code blocks
- scope delimiters
- composite structures
|
< xyz >
|
Chevrons
|
Angle Brackets, Diamond Brackets
|
- html tag delimiters
- generic class argument delimiters
|
References
Wikipedia: Bracket