RosettaCodeData/Task/Create-an-HTML-table/Lingo/create-an-html-table-1.lingo
2023-07-01 13:44:08 -04:00

25 lines
543 B
Text

on htmlTable (data)
str = "<table>"
-- table head
put "<thead><tr><th>&nbsp;</th>" after str
repeat with cell in data[1]
put "<th>"&cell&"</th>" after str
end repeat
put "</tr></thead>" after str
-- table body
put "<tbody>" after str
cnt = data.count
repeat with i = 2 to cnt
put "<tr><td>"&(i-1)&"</td>" after str
repeat with cell in data[i]
put "<td>"&cell&"</td>" after str
end repeat
put "</tr>" after str
end repeat
put "</tbody>" after str
put "</table>" after str
return str
end