[EMAIL PROTECTED] wrote:
I have what is likely to be a simple question about the else keyword.

The usage in the help pages is as follows:

	if(cond) cons.expr  else  alt.expr

I would expect to be able to use it in the following way as well:

	if(cond){
		cons.expr
	}
	else alt.expr

This results a syntax error.

Am I doing something wrong, or doesn't R support the spanning of the
combination of if and else statements over several lines?


I believe this is the ``Introduction to R'' though where I am not sure. You need to have the following instead:

if(cond1) {
do action 1
} else if(cond2) {
do action 2
} else {
do action 3
}

Regards,
Sundar

______________________________________________
[EMAIL PROTECTED] mailing list
http://www.stat.math.ethz.ch/mailman/listinfo/r-help

Reply via email to