Reference.Braces History

Show minor edits - Show changes to markup

May 28, 2007, at 09:04 PM by Paul Badger -
Changed lines 13-14 from:

Unbalanced braces can often lead to cryptic, impenetrable compiler errors that can sometimes be hard to track down in a large program. Because of their varied usages braces are also incredibly important to the syntax of a program and moving a brace one or two lines will often dramatically affect the meaning of a program.

to:

Unbalanced braces can often lead to cryptic, impenetrable compiler errors that can sometimes be hard to track down in a large program. Because of their varied usages, braces are also incredibly important to the syntax of a program and moving a brace one or two lines will often dramatically affect the meaning of a program.

April 14, 2007, at 04:47 PM by Paul Badger -
Added lines 56-58:
April 14, 2007, at 04:37 PM by Paul Badger -
Changed lines 9-14 from:

Beginning programmers and programmers coming to C from the BASIC language often find using braces confusing or daunting. After all, the same curly braces replace the RETURN statement in a subroutine (function), the ENDIF statement in a conditional and the NEXT statement in a FOR loop.

For this reason it is good programming practice to type the closing brace immediately after typing the opening brace when inserting a construct which requires curly braces. Then type some carriage returns between the braces and begin inserting statements, and your braces, and your attitude, will never become unbalanced.

Unbalanced braces can often lead to cryptic, impenetrable compiler errors that can sometimes be hard to track down in a large program. Because of their varied usages braces are also incredibly important to the syntax of a program and moving a brace one or two lines will often dramatically affect the meaning of a program.

to:

Beginning programmers, and programmers coming to C from the BASIC language often find using braces confusing or daunting. After all, the same curly braces replace the RETURN statement in a subroutine (function), the ENDIF statement in a conditional and the NEXT statement in a FOR loop.

Because the use of the curly brace is so varied, it is good programming practice to type the closing brace immediately after typing the opening brace when inserting a construct which requires curly braces. Then insert some carriage returns between your braces and begin inserting statements. Your braces, and your attitude, will never become unbalanced.

Unbalanced braces can often lead to cryptic, impenetrable compiler errors that can sometimes be hard to track down in a large program. Because of their varied usages braces are also incredibly important to the syntax of a program and moving a brace one or two lines will often dramatically affect the meaning of a program.

April 14, 2007, at 04:33 PM by Paul Badger -
Changed lines 15-16 from:

The main uses of curly braces

to:

The main uses of curly braces

April 14, 2007, at 04:31 PM by Paul Badger -
Added lines 15-16:

The main uses of curly braces

Changed lines 21-22 from:
  }
to:
  }@]
April 14, 2007, at 04:28 PM by Paul Badger -
Changed lines 3-4 from:

Curly braces (also referred to as just "braces" or as "curly brackets) are a major part of the C programming language. They are used in several different constructs, outlined below, and this can sometimes be confusing for beginners.

to:

Curly braces (also referred to as just "braces" or as "curly brackets") are a major part of the C programming language. They are used in several different constructs, outlined below, and this can sometimes be confusing for beginners.

April 14, 2007, at 04:27 PM by Paul Badger -
Changed lines 13-14 from:

Unbalanced braces can often lead to cryptic, impenetrable compiler errors that can sometimes be hard to track down in a large program. Because of their varied usages braces are also incredibly important to the syntax of a

to:

Unbalanced braces can often lead to cryptic, impenetrable compiler errors that can sometimes be hard to track down in a large program. Because of their varied usages braces are also incredibly important to the syntax of a program and moving a brace one or two lines will often dramatically affect the meaning of a program.

April 14, 2007, at 04:26 PM by Paul Badger -
Changed lines 1-2 from:

{}Curly Braces

to:

{} Curly Braces

Curly braces (also referred to as just "braces" or as "curly brackets) are a major part of the C programming language. They are used in several different constructs, outlined below, and this can sometimes be confusing for beginners.

An opening curly brace "{" must always be followed by a closing curly brace "}". This is a condition that is often referred to as the braces being balanced. The Arduino IDE (integrated development environment) includes a convenient feature to check the balance of curly braces. Just select a brace, or even click the insertion point immediately following a brace, and its logical companion will be highlighted.

At present this feature is slightly buggy as the IDE will often find (incorrectly) a brace in text that has been "commented out."

Beginning programmers and programmers coming to C from the BASIC language often find using braces confusing or daunting. After all, the same curly braces replace the RETURN statement in a subroutine (function), the ENDIF statement in a conditional and the NEXT statement in a FOR loop.

For this reason it is good programming practice to type the closing brace immediately after typing the opening brace when inserting a construct which requires curly braces. Then type some carriage returns between the braces and begin inserting statements, and your braces, and your attitude, will never become unbalanced.

Unbalanced braces can often lead to cryptic, impenetrable compiler errors that can sometimes be hard to track down in a large program. Because of their varied usages braces are also incredibly important to the syntax of a

April 14, 2007, at 03:30 PM by Paul Badger -
Changed lines 1-8 from:

{}Curly Braces

to:

{}Curly Braces

Functions

[@ void myfunction(datatype argument){

    statements(s)
  }
Changed lines 11-25 from:
while (boolean expression)
{
    statement(s)
}

do
{
    statement(s)
} while (boolean expression);

for (initialisation; termination condition; incrementing expr)
{
    statement(s)
} 
to:
  while (boolean expression)
  {
     statement(s)
  }

  do
  {
     statement(s)
  } while (boolean expression);

  for (initialisation; termination condition; incrementing expr)
  {
     statement(s)
  } 
Changed lines 29-41 from:

if (boolean expression) {

    statement(s)

}

if (boolean expression) {

    statement(s)

} else {

    statement(s)

}

to:
  if (boolean expression)
  {
     statement(s)
  }

  else if (boolean expression)
  {
     statement(s)
  } 
  else
  {
     statement(s)
  }
April 14, 2007, at 03:10 PM by Paul Badger -
Changed line 11 from:

int ledPin = 13;while (boolean expression)

to:

[@while (boolean expression)

Changed lines 24-25 from:

}=]

to:

} @]

April 14, 2007, at 03:08 PM by Paul Badger -
Added lines 1-41:

{}Curly Braces

Loops

int ledPin = 13;while (boolean expression) {

    statement(s)

}

do {

    statement(s)

} while (boolean expression);

for (initialisation; termination condition; incrementing expr) {

    statement(s)

}=]

Conditional statements

if (boolean expression) {

    statement(s)

}

if (boolean expression) {

    statement(s)

} else {

    statement(s)

}

Share