October 2017
Beginner to intermediate
236 pages
7h 38m
English
In the preceding code, first it calculates the remainder within the if statement and compares the result with a zero. If the output of this conditional statement returns TRUE, then the code will print This is an even number; otherwise it will print This is an odd number. So, whenever you run the preceding code, the output will be as follows:
> a <- 9 > if(a %% 2==0){ + print("This is an even number") + } else { + print("This is an odd number") + } [1] "This is an odd number"