I have tried the following simple for next loop in R programming:
for(i in 1:100) { if(i <= 20) { next } print(i) }
Below is the error message I am receiving:
Error: unexpected symbol in "for(i in 1:100) { if(i <= 20) {next} print"
Please help me understand why I am receiving the error.
Give this a shot:
for (i in 1:100) {
if (i<=20) {
next
};
print(i)
}
Looks like you missed your semi-colon. You need this to denote the end of a statement.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With