Like lambda in Python, Scala has similar anonymous function, with different syntax. They are typically used in map and filter and other methods.
//create a RDD object
//rdd: org.apache.spark.rdd.RDD[Int] = ParallelCollectionRDD at parallelize at <console>:29
//add 1 to each element (row) of RDD
//x=>x+1 is a anonymous function, like lambda in Pyton
//return only even elements
//res26: Array[Int] = Array(2, 4)