On Tue, Nov 15, 2011 at 3:46 PM, Kevin Burton <rkevinbur...@charter.net> wrote:
> What is wrong with the following?

AFAIK the else needs to follow the end brace of  if {} on the same
line, at least at the main level.

Peter


>
>
>
> x <- 1:2
>
> if(x[1] > 0)
>
> {
>
>                if(x[2] > 0)
>
>                {
>
>                                print("1 & 2 > 0")
>
>                }
>
>                else
>
>                {
>
>                                print("1 > 0")
>
>                }
>
> }
>
> else
>
> {
>
>                if(x[2] > 0)
>
>                {
>
>                                print("2 > 0")
>
>                }
>
>                else
>
>                {
>
>                                print("NONE > 0")
>
>                }
>
> }
>
>
>
> Gives me
>
>
>
> Error: unexpected 'else' in "else"
______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to