Programming is hard

Programming Is Hard dot com is one around thousand selected web-pages that deserves worth a visit.

This simple for loop, made my day.

1 /// head et al
2 /// whatever you need
3
4 var hour;
5 var ampm;
6
7 for (hour=1; hour<24 br="br" hour="hour"> 8 {
9 if (hour < 12) {ampm="am"};
10 if (hour >= 12) {amppm="pm"};
11
12 if (hour < 13)
13 {
14 document.write(hour + ampm)
15 };
16 else
17 {
18 document.write((hour-12) + ampm)
19 };
20
21 document.write(" ");
22 };


Note from the editor: Revisited this post in 2012, Programming is hard dot com is no longer working. A link to the WayBack Machine has been provided instead.
Newer Post Older Post Home