Monday, October 5, 2009

P02: Find the last but one element of a list.

scala> List(1,2,3,4,5).takeRight(2).head
res0: Int = 4

No comments:

Post a Comment

Sociable