Merge: doc: fixed some typos and other misc. corrections
[nit.git] / examples / rosettacode / html_table.nit
1 #!/usr/bin/env nit
2 #
3 # This file is part of NIT ( http://www.nitlanguage.org ).
4 # This program is public domain
5
6 # Task: Create an HTML table
7 # SEE: <http://rosettacode.org/wiki/Create_an_HTML_table>
8
9 fun html_table(headers: Array[String], values: Array[Array[Int]]): String
10 do
11 var result = "<table><thead><tr>"
12 for v in headers do result += "<th>{v}</th>"
13 result+="</thead><tbody>"
14 for row in values do
15 result += "<tr>"
16 for value in row do
17 result += "<td>{value}</td>"
18 end
19 end
20 result += "</tr></tbody></table>"
21 return result
22 end
23
24 print html_table(["","X","Y","Z"],[[10,20,20,10],[15,23,21,23],[12,10,11,9]])