Anonymous user
Modulinos: Difference between revisions
m
→{{header|Scala}}: -Category:Scala Implementations
(Omit from Go, concurring with Dchapes.) |
|||
Line 1,497:
Test: The meaning of life is 42</lang>
=={{header|Scala}}==
{{libheader|Scala}}
{{works with|Scala|2.10.2}}
===Unix shell script===
This code must be stored as a shell script.
Line 1,513:
println(collatz.toList)
println(s"It has ${collatz.length} elements.")</lang>
===Windows Command Script===
This code must be stored as a Windows Command Script e.g. Hailstone.cmd
Line 1,529 ⟶ 1,530:
println(collatz.toList)
println(s"It has ${collatz.length} elements.")
</lang>
</lang>{{out}}<pre>C:\>Hailstone.cmd 42▼
{{out}}
Use the routine to show that the hailstone sequence for the number: 42.
List(42, 21, 64, 32, 16, 8, 4, 2, 1)
|