From 6f1f887078b8259850c9b31a63ab4e81f6e9c1e0 Mon Sep 17 00:00:00 2001 From: Nathan Lovato Date: Mon, 3 Jun 2019 19:27:37 +0900 Subject: Improve @GDScript.assert documentation Mention that assert only runs in debug builds, closes #29154 --- doc/classes/@GDScript.xml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'doc/classes/@GDScript.xml') diff --git a/doc/classes/@GDScript.xml b/doc/classes/@GDScript.xml index 553fd4d629..b6de5dbf62 100644 --- a/doc/classes/@GDScript.xml +++ b/doc/classes/@GDScript.xml @@ -92,13 +92,13 @@ - Assert that the [code]condition[/code] is [code]true[/code] . If the [code]condition[/code] is [code]false[/code] a fatal error is generated and the program is halted. Useful for debugging to make sure a value is always [code]true[/code]. + Asserts that the [code]condition[/code] is [code]true[/code] . If the [code]condition[/code] is [code]false[/code], an error is generated and the program is halted until you resume it. Only executes in debug builds, or when running the game from the editor. Use it for debugging purposes, to make sure a statement is [code]true[/code] during development. [codeblock] - # Speed should always be between 0 and 20 + # Imagine we always want speed to be between 0 and 20 speed = -10 - assert(speed < 20) # Is true and program continues - assert(speed >= 0) # Is false and program stops - assert(speed >= 0 && speed < 20) # Or combined + assert(speed < 20) # True, the program will continue + assert(speed >= 0) # False, the program will stop + assert(speed >= 0 && speed < 20) # You can also combine the two conditional statements in one check [/codeblock] -- cgit v1.2.3