You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Inside of my learnr tutorial, I'm getting warnings whenever I use else if. See below (lines 6, 8, 10):
Here is the code for the exercise and its solution
{r KC2, exercise=TRUE, exercise.lines=15}
# YOUR WORK HERE
# Subtract 85 from 100 and assign the result to an object named `score`
# If score is 90 or above, assign "A" to an object named `grade`
# Otherwise if the `score` is 80 or above, assign "B" to an object named `grade`
# Otherwise if the `score` is 70 or above, assign "C" to an object named `grade`
# Otherwise if the `score` is 60 or above, assign "D" to an object named `grade`
# Otherwise if the `score` is below 60, assign "Hidden" to an object named `grade`
# Print the value stored in `grade`
{r KC2-solution}
# Subtract 85 from 100 and assign the result to an object named `score`
score = 100 - 85
if (score >= 90){ # If score is 90 or above, assign "A" to an object named `grade`
grade <- "A"
} else if (score >= 80){ # Otherwise if the `score` is 80 or above, assign "B" to an object named `grade`
grade <- "B"
} else if (score >= 70){ # Otherwise if the `score` is 70 or above, assign "C" to an object named `grade`
grade <- "C"
} else if (score >= 60){ # Otherwise if the `score` is 60 or above, assign "D" to an object named `grade`
grade <- "D"
} else{ # Otherwise if the `score` is below 60, assign "Hidden" to an object named `grade`
grade <- "Hidden"
}
# Print the value stored in `grade`
print(grade)
The text was updated successfully, but these errors were encountered:
gadenbuie
changed the title
Warning: unexpected symbol 'if' when using else if
Exercise editor linting warns of unexpected symbol when using if ... else ifJun 30, 2021
Inside of my learnr tutorial, I'm getting warnings whenever I use
else if
. See below (lines 6, 8, 10):Here is the code for the exercise and its solution
Does anyone know why this is happening?
Additional info from RStudio Community Post
The text was updated successfully, but these errors were encountered: