Skip to Main Content
Introduction to Computational Modeling Using C and Open-Source Tools
book

Introduction to Computational Modeling Using C and Open-Source Tools

by Jose M. Garrido
November 2013
Intermediate to advanced content levelIntermediate to advanced
461 pages
12h 1m
English
CRC Press
Content preview from Introduction to Computational Modeling Using C and Open-Source Tools
422 Introduction to Computational Modeling
for variable [in argument list]
do
command block
done
The following example shows a short script file with a for loop.
# File: loopex1. Example of for-loop
# for system in Linux Windows Solaris OS2 MacOSX
do
echo $system
done
The execution of the script file is shown in the following listing:
./loopex1
Linux
Windows
Solaris
OS2
MacOSX
The while loop allows repeated execution of a block of commands based on a
condition of an expression. The general syntax of the while command follows.
while expression
do
command-block
done
The expression in the while command is evaluated and if true, the command
block is executed and the expression is again evaluated. The sequence is repeated
until the expression evaluates to false. The following ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Computer Fundamentals and Programming in C (RMK)

Computer Fundamentals and Programming in C (RMK)

Anita Goel, Ajay Mittal

Publisher Resources

ISBN: 9781482216783