Skip to content
Prev 171582 / 398503 Next

R parser for If-else

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