Help, R not printing my code, just relisting it?

Hi, I just got started with R and I'm sure this is a really simple issue, but whenever I try to run a simple if statement and print an output, the output is just the code I've written? What I try to code is

a <- 5
if (a>3){
  print("a is bigger than 3")
} else if (a==3) {
  print("a equals to 3")
} else {
  print("a is less than 3")
}

but the output is

+ a <- 5
+ if (a>3){
+   print("a is bigger than 3")
+ } else if (a==3) {
+   print("a equals to 3")
+ } else {
+   print("a is less than 3")
+ }

What should I change? Thank you.

This indicates your console is in a state where it is waiting for you to finish writing a command, this usually happens when you forgot to close parenthesis or similar. Just press Esc until you see the console prompt (>) and execute your code again.

1 Like

Thank you so much that fixed it

This topic was automatically closed 42 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.