Category talk:Wren-check: Difference between revisions

→‎Source code: Added Check.ok method.
(→‎Source code: Added a method to check if a string is a valid identifier.)
(→‎Source code: Added Check.ok method.)
Line 4:
 
/*
Check is a class containing static methods to check that a particular value is:
(1) a particular value is of a given type or types and, where possible, within a given range of values.
a given range of values; or
(2) a more general condition is met.
If it isn't, the fiber is aborted with an appropriate error message.
*/
Line 284 ⟶ 286:
}
}
 
/* Methods to check if a condition is met. */
static ok(condition, message) {
if (!condition) Fiber.abort(message)
}
 
static ok(condition) { ok(condition, "Condition is not met.") }
}</lang>
9,492

edits