Skip to content

Helper method to communicate that the user's submission was correct or incorrect. These functions were originally designed for developers to create question_is_correct() methods for custom question types, but they can also be called inside the functions created by answer_fn() to dynamically determine the result and message provided to the user.


correct(messages = NULL)

incorrect(messages = NULL)

mark_as(correct, messages = NULL)



A vector of messages to be displayed. The type of message will be determined by the correct value. Note that markdown messages are not rendered into HTML, but you may provide HTML using htmltools::HTML() or htmltools::tags.


Logical: is the question answer is correct


Returns a list with class learnr_mark_as to be returned from the question_is_correct() method for the learnr question type.

See also


# Radio button question implementation of `question_is_correct` <- 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)