Browse Source

Merge pull request #2722 from Chaosus/shader_switch

Note about switch in shaders
Yuri Roubinsky 6 years ago
parent
commit
8df41bedba
1 changed files with 13 additions and 0 deletions
  1. 13 0
      tutorials/shading/shading_reference/shading_language.rst

+ 13 - 0
tutorials/shading/shading_reference/shading_language.rst

@@ -331,6 +331,19 @@ Godot Shading language supports the most common types of flow control:
 
     }
 
+    // switch
+    switch(i) { // signed integer expression
+        case -1:
+            break;
+        case 0:
+            return; // break or return
+        case 1: // pass-through
+        case 2:
+            break;
+        //...
+        default: // optional
+    }
+
     // for loops
     for (int i = 0; i < 10; i++) {