The R Project SVN R

Rev

Rev 30824 | Rev 37590 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 30824 Rev 33449
Line 36... Line 36...
36
    of the form \code{\{ expr1 ; expr2 \}}.
36
    of the form \code{\{ expr1 ; expr2 \}}.
37
  }
37
  }
38
}
38
}
39
\details{
39
\details{
40
  \code{break} breaks out of a \code{for}, \code{while} or \code{repeat}
40
  \code{break} breaks out of a \code{for}, \code{while} or \code{repeat}
41
  loop, that is goes to the first statement after the loop.
41
  loop; control is transferred to the first statement outside the inner-most loop.
42
  \code{next} transfer control to the first statement of the loop (after
42
  \code{next} halts the processing of the current iteration and advances the
43
  advancing \code{var} along \code{seq} in a \code{for} loop).  They
43
  looping index. Both \code{break} and \code{next} apply only to the innermost 
44
  both apply only to the innermost of nested loops.
44
  of nested loops.
45
  
45
  
46
  Note that it is a common mistake to forget to put braces (\code{\{ .. \}})
46
  Note that it is a common mistake to forget to put braces (\code{\{ .. \}})
47
  around your statements, e.g., after \code{if(..)} or \code{for(....)}.
47
  around your statements, e.g., after \code{if(..)} or \code{for(....)}.
48
  In particular, you should not have a newline between \code{\}} and 
48
  In particular, you should not have a newline between \code{\}} and 
49
  \code{else} to avoid a syntax error in entering a \code{if ... else}
49
  \code{else} to avoid a syntax error in entering a \code{if ... else}
50
  construct at the keyboard or via \code{source}.
50
  construct at the keyboard or via \code{source}.
51
  For that reason, one (somewhat extreme) attitude of defensive programming
51
  For that reason, one (somewhat extreme) attitude of defensive programming
52
  uses braces always, e.g., for \code{if} clauses.
52
  is to always use braces, e.g., for \code{if} clauses.
53
 
53
 
54
  The index \code{seq} in a \code{for} loop is evaluated at the start of
54
  The index \code{seq} in a \code{for} loop is evaluated at the start of
55
  the loop; changing it subsequently does not affect the loop.  The
55
  the loop; changing it subsequently does not affect the loop.  The
56
  variable \code{var} has the same type as \code{seq}.  If \code{seq} is
56
  variable \code{var} has the same type as \code{seq}.  If \code{seq} is
57
  a factor (which is not strictly allowed) then its internal codes are
57
  a factor (which is not strictly allowed) then its internal codes are