1// PHP:
2foreach ($array as $val) {
3 print($val);
4}
5
6// C#
7foreach (String val in array) {
8 console.writeline(val);
9}
10
11// Python
12for val in array:
13 print(val)
1names = ['tom', 'john', 'simon']
2
3namesCapitalized = [capitalize(n) for n in names]
1# Python doesn't have a foreach statement per se.
2# It has for loops built into the language.
3# As a side note the for element in iterable syntax comes from
4# the ABC programming language, one of Python's influences