Debugging and Inspection
Assertion Check
Compare a Value
A small assertion turns an assumption into a visible TRUE or FALSE value.
Program
Play the script to change the limit and see whether the value passes.
assertion_check.R
limit <-
value <- 12
ok <- value <= limit
label <- paste("ok", ok, sep = ":")
cat(label, "\n", sep = "")
limit <-
value <- 12
ok <- value <= limit
label <- paste("ok", ok, sep = ":")
cat(label, "\n", sep = "")
limit <-
value <- 12
ok <- value <= limit
label <- paste("ok", ok, sep = ":")
cat(label, "\n", sep = "")
assumption
The limit records what value is considered acceptable.
check
`value <= limit` turns the assumption into a logical result.
inspection label
Printing the result makes the failed or passed check explicit.