Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes && problem in logic lesson #6

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions Logic/initLesson.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# For compatibility with 4.3.1

# Dummy function to advance user past question for which
# correct answer yields an error
ok <- function() {
invisible()
}
18 changes: 10 additions & 8 deletions Logic/lesson.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -143,16 +143,18 @@
statement as c(TRUE, TRUE, TRUE) & c(TRUE, FALSE, FALSE).

- Class: cmd_question
Output: "Now we'll type the same expression except we'll use the `&&` operator. Type the expression TRUE && c(TRUE, FALSE, FALSE)."
CorrectAnswer: "TRUE && c(TRUE, FALSE, FALSE)"
AnswerTests: omnitest(correctExpr='TRUE && c(TRUE, FALSE, FALSE)')
Output: "Now we'll type the same expression except we'll use the `&&` operator. Type the expression TRUE && c(TRUE, FALSE, FALSE). In versions of R > 4.3.0, YOU WILL GET AN ERROR. Once you get the error, type ok() to continue to the next question."
CorrectAnswer: ok()
AnswerTests: omnitest(correctExpr="ok()")
Hint: "As you'll see, the && version of AND works differently. Type:
TRUE && c(TRUE, FALSE, FALSE)"
TRUE && c(TRUE, FALSE, FALSE), then type ok() to continue to the next question."

- Class: text
Output: "In this case, the left operand is only evaluated with the first member
of the right operand (the vector). The rest of the elements in the vector
aren't evaluated at all in this expression."
- Class: cmd_question
Output: "Now type the expression TRUE && TRUE"
CorrectAnswer: TRUE && TRUE
AnswerTests: omnitest(correctExpr="TRUE && TRUE")
Hint: "Now to see how the && operator works with a vector, type:
TRUE && TRUE"

- Class : text
Output: The OR operator follows a similar set of rules. The `|` version of OR
Expand Down