Browse Source

Merge pull request #1993 from clayjohn/constants

Add constant example to gdscript_basics
Rémi Verschelde 6 years ago
parent
commit
d43b9a3192
1 changed files with 1 additions and 0 deletions
  1. 1 0
      getting_started/scripting/gdscript/gdscript_basics.rst

+ 1 - 0
getting_started/scripting/gdscript/gdscript_basics.rst

@@ -640,6 +640,7 @@ expressions and must be assigned on initialization.
     const E = [1, 2, 3, 4][0] # Constant expression: 1
     const E = [1, 2, 3, 4][0] # Constant expression: 1
     const F = sin(20) # sin() can be used in constant expressions.
     const F = sin(20) # sin() can be used in constant expressions.
     const G = x + 20 # Invalid; this is not a constant expression!
     const G = x + 20 # Invalid; this is not a constant expression!
+    const H = A + 20 # Constant expression: 25
 
 
 Although the type of constants is inferred from the assigned value, it's also
 Although the type of constants is inferred from the assigned value, it's also
 possible to add explicit type specification::
 possible to add explicit type specification::