This code expects the DM.result variable to be defined by the DataCamp frontend. There is need to define the success_msg seperately, since it is defined inside the function.

check_mc(state, correct, no_selection_msg = NULL, feedback_msgs = NULL)

Arguments

state

the state passed to it. Use ex() at all times.

correct

number of the correct answer (or vector of numbers, if several options are fine)

no_selection_msg

feedback message in case the student did not select an answer.

feedback_msgs

vector of feedback messages for both the incorrect exercises as the correct exercise. Order the messages according to how they are listed in the instructions. For example, if there are four options, the second of which is correct, a vector of four feedback messages should be provided. The first message corresponds to feedback on the incorrect selection of the first option, the second message corresponds to the feedback message for the correct collection. The third and fourth messages correspond to feedback on the incorrect selection of the third and fourth option.

Examples

if (FALSE) { # Example solution: second instruction correct out of three options. # Corresponding SCT: msg1 <- "Not good, try again!" msg2 <- "Nice one!" msg3 <- "Not quite, give it another shot." ex() %>% check_mc(2, feedback_msgs = c(msg1, msg2, msg3)) }