Helper method to return

correct(messages = NULL)

incorrect(messages = NULL)

mark_as(correct, messages = NULL)

Arguments

messages

a vector of messages to be displayed. The type of message will be determined by the correct value.

correct

boolean that determines if a question answer is correct

Examples

# Radio button question implementation of `question_is_correct`
question_is_correct.radio <- function(question, value, ...) {
  for (ans in question$answers) {
    if (as.character(ans$option) == value) {
      return(mark_as(
        ans$correct,
        ans$message
      ))
    }
  }
  mark_as(FALSE, NULL)
}