Middle three digits: Difference between revisions

Content deleted Content added
→‎{{header|Scala}}: Marked incomplete as I think it would fail for 10100 for example.
Line 716:
middle_three_digits(0) returned: Failure, Too short</pre>
=={{header|Scala}}==
{{incomplete|Scala|I just noticed that if intVals contained 10100 then your output would be "10" instead of '010' I think.}}
<lang scala>/**
* Optionally return the middle three digits of an integer.
Line 736 ⟶ 735:
intVals map (middleThree(_)) map {
case None => "No middle three"
case Some(v) if=> f"${v}%03d" == 0 =>// "000"Format the value, force leading zeroes
case Some(v) => v.toString
} mkString("\n")
</lang>