官术网_书友最值得收藏!

Function literals

Function literals are a syntactical way of representing a function. The basic structure of a function is something that can take some parameters and return a response. If we've to represent a function that takes an Int value and respond in String, it will be like this:

Int => String

The left-hand side represents the input parameters, and the right-hand side gives parameters that are response type. The type of preceding function literal is Function1[Int, String], and parameters Int and String are representing input and output parameters respectively. We'll discuss these more when we talk about functions in subsequent chapters.

We have discussed how literals are represented in Scala, and now that we know this, we've got a heads up to go ahead with data types.

主站蜘蛛池模板: 璧山县| 海安县| 怀集县| 建始县| 北安市| 米泉市| 银川市| 九台市| 天柱县| 香港| 沙河市| 南江县| 酒泉市| 海兴县| 沛县| 克东县| 五华县| 嘉禾县| 离岛区| 开平市| 尼玛县| 璧山县| 禹城市| 甘孜县| 龙门县| 吉安市| 连州市| 阳春市| 阿鲁科尔沁旗| 乐平市| 通城县| 临泉县| 永和县| 曲靖市| 乡城县| 长治县| 酒泉市| 兴化市| 醴陵市| 房产| 德州市|