FizzBuzz/AWK: Difference between revisions

Content added Content deleted
Line 117: Line 117:


==Custom FizzBuzz==
==Custom FizzBuzz==
Example program generated from "General FizzBuzz‎",
Example program generated from [[General_FizzBuzz#AWK]],
for factors 2, 3, 5 using the words A, B, C.
for factors 2, 3, 5 using the words A, B, C. <br>
The list of numbers is also generated (much like in version 2 and 3),
and comes in as the file numbers.txt.
<!-- http://ideone.com/yw1oEK -->
<!-- http://ideone.com/yw1oEK -->
<lang AWK># usage: awk -f fizzbuzzCustom.awk numbers.txt
<lang AWK># usage: awk -f fizzbuzzCustom.awk numbers.txt
Line 130: Line 132:
x=="" {print $0; next}
x=="" {print $0; next}
{print "\t" x; x=""}
{print "\t" x; x=""}

END {print "# Done."} </lang>
END {print "# Done."} </lang>