diff options
author | Thanos Apollo <[email protected]> | 2023-12-12 16:14:14 +0200 |
---|---|---|
committer | Thanos Apollo <[email protected]> | 2023-12-12 16:14:14 +0200 |
commit | e9ee5cd8c6a2958d5b5f867eb016b335110b8ccd (patch) | |
tree | 190febb5ac99d4e56241e433016e81d6e13babf5 /gnosis.el | |
parent | 4da784814ee2a1767aeb67cda2d8dfd8141a4260 (diff) |
mcq: Add error catch when correct-answer is not a number
Diffstat (limited to 'gnosis.el')
-rw-r--r-- | gnosis.el | 4 |
1 files changed, 3 insertions, 1 deletions
@@ -102,7 +102,9 @@ use it like this: :choices (gnosis--ask-input "Choices") :correct-answer (string-to-number (read-string "Which is the correct answer (number)? ")) :tags (gnosis--ask-input "Tags"))) - (gnosis--insert-into 'notes `([nil "mcq" ,question ,choices ,correct-answer 0 0 ,tags]))) + (when (equal (numberp correct-answer)) + (error "The correct answer must be the number of the correct answer")) + (gnosis--insert-into 'notes `([nil "mcq" ,question ,choices ,correct-answer ,tags, nil, nil nil]))) (defun gnosis-create-question (type) "Create question as TYPE." |