diff options
author | AidenRushbrooke <72034940+AidenRushbrooke@users.noreply.github.com> | 2021-12-08 04:37:18 +0000 |
---|---|---|
committer | AidenRushbrooke <72034940+AidenRushbrooke@users.noreply.github.com> | 2021-12-08 04:37:18 +0000 |
commit | 0d32b01fde73224469b8bb5971ebdaacd9bfa32c (patch) | |
tree | a6ff8bd4dbbf144cb112d24785b525ce2b59fb8a /src/examples | |
parent | 5c4d41c63af3ef064090336a14efe91931051e7e (diff) | |
download | esotericFORTRAN-0d32b01fde73224469b8bb5971ebdaacd9bfa32c.tar.gz esotericFORTRAN-0d32b01fde73224469b8bb5971ebdaacd9bfa32c.zip |
Fixed bug with function return and added recursive example
Diffstat (limited to 'src/examples')
-rw-r--r-- | src/examples/recursive.ft | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/examples/recursive.ft b/src/examples/recursive.ft new file mode 100644 index 0000000..d6f7a69 --- /dev/null +++ b/src/examples/recursive.ft @@ -0,0 +1,14 @@ +program recursive +int::value +int::final +value=5 +final=factorial(value) +print*,"The factorial of ",value," is ",final +end program recursive + +function int factorial(int x) +if x==1 then +return 1 +end if +return x*factorial(x-1) +end
\ No newline at end of file |