x<-5
if(x%%2==0)
print(“X is an even number”)
else
print(“X is an odd number”)
Executing the above code will result in an error as shown below -
Error: :4:1: unexpected ‘else’
3: print(“X is an even number”)
4: else
^
R programming language does not know if the else related to the first ‘if’ or not as the first if() is a complete command on its own.