Anonymous user
Pascal's triangle: Difference between revisions
→{{header|Scala}}
Line 783:
end</lang>
=={{header|Scala}}==
Simple recursive
<lang scala>
def tri(rows:Int):List[Int] = { rows match {
Line 791:
}
</lang>
Funtion to pretty print
<lang scala>
def prettytri(r:Int) = (1 to r) foreach {n=>print(" "*(r-n)); tri(n) map (c=>print(c+" ")); println}
|