]> git.xonotic.org Git - xonotic/gmqcc.git/blobdiff - tests/rassign.qc
return assignment factorial test
[xonotic/gmqcc.git] / tests / rassign.qc
index 7e3d0e61f1b24cb5ace0b225081d7c2c50aa35c5..69ec31cf9017ff0a18c361bddbbae4c2170fefb8 100644 (file)
@@ -9,7 +9,7 @@ vector f_vector() {
     foo.x = f_float();
     foo.y = f_float();
     foo.z = f_float();
-    
+
     return = foo;
     return;
 }
@@ -20,8 +20,16 @@ string f_string() {
     return;
 }
 
+float factorial(float n) {
+    if (n == 0) return = 1;
+    else        return = n * factorial(n - 1);
+
+    return;
+}
+
 void main() {
     print(ftos(f_float()), "\n");  // 200.0f
     print(vtos(f_vector()), "\n"); // '1 2 3'
     print(f_string(), "\n");       // world
+    print(ftos(factorial(4)), "\n"); // 24
 }