diff options
author | AidenRushbrooke <72034940+AidenRushbrooke@users.noreply.github.com> | 2021-12-09 02:30:57 +0000 |
---|---|---|
committer | AidenRushbrooke <72034940+AidenRushbrooke@users.noreply.github.com> | 2021-12-09 02:30:57 +0000 |
commit | 13c44054b21d26782e98a52e9a114250ab8307ff (patch) | |
tree | 8426476b4daeee01b85cc3f414d04335dbf0a87d /src/examples/function.ft | |
parent | 560a48eebf4f74ae1a21d5cfbb3b55477d7c1356 (diff) | |
download | esotericFORTRAN-13c44054b21d26782e98a52e9a114250ab8307ff.tar.gz esotericFORTRAN-13c44054b21d26782e98a52e9a114250ab8307ff.zip |
Added example program of each main feature
Diffstat (limited to 'src/examples/function.ft')
-rw-r--r-- | src/examples/function.ft | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/examples/function.ft b/src/examples/function.ft new file mode 100644 index 0000000..2c6ed7d --- /dev/null +++ b/src/examples/function.ft @@ -0,0 +1,18 @@ +program example +real::a +real::root +a=30 +root=sqrt(a) +print*,"The square root of ",a," is ",root +end program example + +!Function to calculate the square root of a value +function real sqrt(real value) +real::result +result=1 +int::count +do count=0,10 +result =(result+value/result)/2 +end do +return result +end
\ No newline at end of file |