[R] R parser for If-else

Dani danicyber at gmail.com
Tue Feb 24 23:09:36 CET 2009


Hi list,

I don't know if somebody has spent a lot of time debugging strange
problems with if else positioning - the parser seems to recognize only
the syntax bellow - this is the only way of making these pieces of
code to work.

As far as i'm concerned, no examples were available (it would be so
awesome to have them in the introductory manual!)

#Try to change the placement of the keywords and you are dead! 4 examples
Ex1:
if (1==1){
 print('if')
 print('if again')
 }else
 print('else')

Ex2:
if (2==2) print('if') else print('else')

Ex3:
if (2==2){
 print('if')
 print('if again')
 }else
 {
 print('else')
 print('else2')
 }

Ex4:
if (2==2){
 print('if')
 print('if again')
}else print('else')



cheers,
-------------------------------------
Daniela




More information about the R-help mailing list