music |
| | OSdata.com |
flow control
summary
This subchapter looks at flow control in UNIX (and Linux).
flow control
This subchapter looks at flow control in UNIX (and Linux).
The three basic kinds of instructions in structured programming are: sequence, decision, and loop.
A sequence is a series of instructions performed in the same order every time.
A decision makes a choice between two or more different possible sequences of instructions.
A loop repeats a sequence of instructions repeatedly.
The basic two flow control decision statements are if and case.
The basic three flow control loops are while, for, and select.
if
The basic format of the if statement:
if list1 ; then list2 ; elif list3 ; then list4 else list5 fi
case
The basic format of the case statement:
case expression in
pattern1) list1 ;;
patternN) listN ;;
esac
while
The basic format of the while loop:
while expression ; do list ; done
for
The basic format of the for loop:
for var in word1
wordN ; do list ; done
select
The basic format of the select loop:
select var in word1
wordN ; do list ; done
comments, suggestions, corrections, criticisms
free music player coding example
Coding example: I am making heavily documented and explained open source code for a method to play music for free almost any song, no subscription fees, no download costs, no advertisements, all completely legal. This is done by building a front-end to YouTube (which checks the copyright permissions for you).
View music player in action: www.musicinpublic.com/.
Create your own copy from the original source code/ (presented for learning programming).
Because I no longer have the computer and software to make PDFs, the book is available as an HTML file, which you can convert into a PDF.
Names and logos of various OSs are trademarks of their respective owners.