I am building a learnr tutorial to teach students about while loops.
Within the tutorial, I have an exercise:
Assign 0 to an object named `int_value`
Increment `int_value` by 3 while it is less than or equal to 999
Print the value stored in `int_value`
I am trying to use gradethis to provide "nudges" to help students get to the correct solution, but in this case, there might be some limitations.
Suppose a student's incorrect solution is:
# Assign 0 to an object named `int_value`
int_value <- 0
# Print the value stored in `int_value`
while(int_value <= 999){
print(int_value)
}
I want to be able to provide feedback: "Incorrect. You need to increment int_value
by 3 within the loop." However, since the incorrect solution causes an infinite loop, there is an error (Error: Your code ran longer than the permitted timelimit for this exercise), and none of the logic in me *-check
code chunk is applied.
Is there a way to provide feedback/hints to students when their code errors out?