Skip to content
Prev 76018 / 398502 Next

priority of operators in the FOR ( ) statement

On 8/23/05, Ravi.Vishnu at outokumpu.com <Ravi.Vishnu at outokumpu.com> wrote:
?Syntax gives the operator precedence.

Also, note that : is probably best not used in functions since it does
not handle boundary conditions properly.   If n were 0 then 1:n 
results in two iterations corresonding to 1 and 0 but what you
really wanted was likely no iterations at all.  To do that you need
seq(length = n) rather than ":".   

Also I have found expressions like 0:1/10 handy to generate 
0, .1, .2, ..., 1 and that works with the current precedence.