From 06f3cd8bd85af960c6bfcf427d65b8fdd0e1475f Mon Sep 17 00:00:00 2001 From: Danil Alexeev Date: Mon, 14 Sep 2020 19:19:30 +0300 Subject: [PATCH] Several documentation improvements (cherry picked from commit a4c57903506a832e5be047c28026b376a90c0388) --- doc/classes/Node.xml | 2 +- modules/gdscript/doc_classes/@GDScript.xml | 73 ++++++++-------------- 2 files changed, 26 insertions(+), 49 deletions(-) diff --git a/doc/classes/Node.xml b/doc/classes/Node.xml index 11ca7a309e5..56c92229a21 100644 --- a/doc/classes/Node.xml +++ b/doc/classes/Node.xml @@ -531,7 +531,7 @@ ┠╴Menu ┃ ┠╴Label ┃ ┖╴Camera2D - ┖-SplashScreen + ┖╴SplashScreen ┖╴Camera2D [/codeblock] diff --git a/modules/gdscript/doc_classes/@GDScript.xml b/modules/gdscript/doc_classes/@GDScript.xml index c6a66159e7f..93ce9870c9f 100644 --- a/modules/gdscript/doc_classes/@GDScript.xml +++ b/modules/gdscript/doc_classes/@GDScript.xml @@ -378,24 +378,19 @@ Returns the floating-point modulus of [code]a/b[/code] that wraps equally in positive and negative. [codeblock] - var i = -6 - while i < 5: - prints(i, fposmod(i, 3)) - i += 1 + for i in 7: + var x = 0.5 * i - 1.5 + print("%4.1f %4.1f %4.1f" % [x, fmod(x, 1.5), fposmod(x, 1.5)]) [/codeblock] Produces: [codeblock] - -6 0 - -5 1 - -4 2 - -3 0 - -2 1 - -1 2 - 0 0 - 1 1 - 2 2 - 3 0 - 4 1 + -1.5 -0.0 0.0 + -1.0 -1.0 0.5 + -0.5 -0.5 1.0 + 0.0 0.0 0.0 + 0.5 0.5 0.5 + 1.0 1.0 1.0 + 1.5 0.0 0.0 [/codeblock] @@ -770,24 +765,18 @@ Returns the integer modulus of [code]a/b[/code] that wraps equally in positive and negative. [codeblock] - var i = -6 - while i < 5: - prints(i, posmod(i, 3)) - i += 1 + for i in range(-3, 4): + print("%2.0f %2.0f %2.0f" % [i, i % 3, posmod(i, 3)]) [/codeblock] Produces: [codeblock] - -6 0 - -5 1 - -4 2 - -3 0 - -2 1 - -1 2 - 0 0 - 1 1 - 2 2 - 3 0 - 4 1 + -3 0 0 + -2 -2 1 + -1 -1 2 + 0 0 0 + 1 1 1 + 2 2 2 + 3 0 0 [/codeblock] @@ -990,27 +979,15 @@ Returns an array with the given range. Range can be 1 argument N (0 to N-1), two arguments (initial, final-1) or three arguments (initial, final-1, increment). [codeblock] - for i in range(4): - print(i) - for i in range(2, 5): - print(i) - for i in range(0, 6, 2): - print(i) + print(range(4)) + print(range(2, 5)) + print(range(0, 6, 2)) [/codeblock] Output: [codeblock] - 0 - 1 - 2 - 3 - - 2 - 3 - 4 - - 0 - 2 - 4 + [0, 1, 2, 3] + [2, 3, 4] + [0, 2, 4] [/codeblock]