Problem 01

This commit is contained in:
2026-03-19 15:36:32 +01:00
commit 09af2a25e8
4 changed files with 48 additions and 0 deletions
@@ -0,0 +1,13 @@
package ninetyNineScalaProblems
object Problem01:
def lastElement(list: List[Any]): Option[Any] =
list match
case Nil => None
case _ => Some(list(list.length - 1))
object Problem01Stdlib:
def lastElement(list: List[Any]): Option[Any] =
list match
case Nil => None
case _ => Some(list.last)