Merge branch 'master' of https://github.com/thomasdenney/pxt-microbit
This commit is contained in:
commit
99d05ec91b
@ -23,18 +23,17 @@ namespace control {
|
|||||||
* Display specified error code and stop the program.
|
* Display specified error code and stop the program.
|
||||||
*/
|
*/
|
||||||
//% shim=pxtrt::panic
|
//% shim=pxtrt::panic
|
||||||
export function panic(code: number) {
|
export function panic(code: number) { }
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If the condition is false, display msg on serial console, and panic with code 098.
|
* If the condition is false, display msg on serial console, and panic with code 098.
|
||||||
*/
|
*/
|
||||||
export function assert(condition:boolean, msg?: string)
|
export function assert(condition: boolean, msg ?: string) {
|
||||||
{
|
|
||||||
if (!condition) {
|
if (!condition) {
|
||||||
console.log("ASSERTION FAILED")
|
console.log("ASSERTION FAILED")
|
||||||
if (msg != null)
|
if (msg != null) {
|
||||||
console.log(msg)
|
console.log(msg)
|
||||||
|
}
|
||||||
panic(98)
|
panic(98)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user