[Rd] Whitespace matters in else construct (PR#1125)
Prof Brian D Ripley
ripley@stats.ox.ac.uk
Wed, 10 Oct 2001 17:47:59 +0100 (BST)
This is a documented feature: more accurately, newlines matter. An R
statement is terminated if it is syntactically complete at the end of the
line.
See the reference manual section 10.2.5 for an explicit statement.
On Wed, 10 Oct 2001 jens.lund@nordea.com wrote:
> Full_Name: Jens Lund
> Version: 1.3.1
> OS: Windows
> Submission from: (NULL) (194.239.194.210)
>
>
> Whitespace matters in else constructions; a newline does not seem to be allowed
> in front of else:
>
> # Valid input examples
> if (F) {
> print(T)
> } else print(F)
>
> if (T) print(T) else print(F)
>
> if (F) {print(T)
> } else print(F)
>
> # Invalid input examples
> if (F) {
> print(T)
> }
> else print(F)
>
> if (F)
> print(T)
> else print(F)
>
> > version
> _
> platform i386-pc-mingw32
> arch x86
> os Win32
> system x86, Win32
> status
> major 1
> minor 3.1
> year 2001
> month 08
> day 31
> language R
>
> Best regards, Jens
>
>
> -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
> r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
> Send "info", "help", or "[un]subscribe"
> (in the "body", not the subject !) To: r-devel-request@stat.math.ethz.ch
> _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
>
--
Brian D. Ripley, ripley@stats.ox.ac.uk
Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel: +44 1865 272861 (self)
1 South Parks Road, +44 1865 272860 (secr)
Oxford OX1 3TG, UK Fax: +44 1865 272595
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._