Curly bracket

Curly bracketAlternatively referred to as an open brace, close brace, and squiggly brackets, curly brackets are found on the same keys as the open bracket ( [ ) and close bracket ( ] ) on US keyboards.

How are curly brackets used?

These keys are most commonly used in curly bracket programming languages such as C, Java, Perl, and PHP to enclose groups of statements. Below is an example of how an enclosed statement looks like in Perl.

$value = 0;
do {
if ($value >= 10) {
print "Value is equal to or greater than 10. Ending.";
} until ($value >= 100);

In the above example are two enclosed statements using curly brackets. The first group is the do loop that continues to increase the value of $value variable up to 100. Within that group is the if statement that checks to see if $value is greater than or equal to 10 and if it is print a message and exit the script.

Related pages

Also see: Keyboard terms, Programming terms, Square bracket