As mentioned by @Alex P you have an extra {.
However you can also simplify your else if by just checking if i is greater than equal 3 (you already know i will be less than or equal to 6 from it failing the first if condition where you check if i > 6):
i <- 1
while(i <=10) {
if(i > 6) {
cat("i =", i, "and is bigger than 6.\n")
} else if(i >= 3) {
cat("i =", i ,"and is between 3 and 6 inclusive.\n")
} else {
cat("i =", i ,"and is less than 3.\n")
}
i = i + 1
cat("At the bottom of the loop i is now =", i ,"\n")
}
Output:
i = 1 and is less than 3.
At the bottom of the loop i is now = 2
i = 2 and is less than 3.
At the bottom of the loop i is now = 3
i = 3 and is between 3 and 6 inclusive.
At the bottom of the loop i is now = 4
i = 4 and is between 3 and 6 inclusive.
At the bottom of the loop i is now = 5
i = 5 and is between 3 and 6 inclusive.
At the bottom of the loop i is now = 6
i = 6 and is between 3 and 6 inclusive.
At the bottom of the loop i is now = 7
i = 7 and is bigger than 6.
At the bottom of the loop i is now = 8
i = 8 and is bigger than 6.
At the bottom of the loop i is now = 9
i = 9 and is bigger than 6.
At the bottom of the loop i is now = 10
i = 10 and is bigger than 6.
At the bottom of the loop i is now = 11
{'s. I would add to this that you would be well advised to take more care with how you format your code. Use spaces and indents correctly, and you will be much less likely to run into such problems.