diff options
author | P. J. McDermott <pj@pehjota.net> | 2016-02-28 23:35:27 (EST) |
---|---|---|
committer | P. J. McDermott <pj@pehjota.net> | 2016-02-28 23:35:27 (EST) |
commit | 7cc072f43039f911d90dea7e43d6211a3acc5e79 (patch) | |
tree | ff80c9c7b217de67f8c4da4bc1f4995a7fe8fa15 /eshtrans | |
parent | ef54a28f5211cca6d5bd2fc6ada2ae520ab985b7 (diff) | |
download | eggshell-7cc072f43039f911d90dea7e43d6211a3acc5e79.zip eggshell-7cc072f43039f911d90dea7e43d6211a3acc5e79.tar.gz eggshell-7cc072f43039f911d90dea7e43d6211a3acc5e79.tar.bz2 |
eshtrans: Add parameter list example program
Diffstat (limited to 'eshtrans')
-rw-r--r-- | eshtrans/funcparams.esh | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/eshtrans/funcparams.esh b/eshtrans/funcparams.esh new file mode 100644 index 0000000..cfabe61 --- /dev/null +++ b/eshtrans/funcparams.esh @@ -0,0 +1,17 @@ +# Example of parameter lists and argument type checking. + +greet(bool doprint, int i, string s) +{ + if ${doprint}; then + while [ ${i} -gt 0 ]; do + printf '%s\n' "${s}" + i=$((${i} - 1)) + done + fi +} + +main() +{ + greet true 3 'Hello, world!' + return 0 +} |