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

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.

主站蜘蛛池模板: 武邑县| 彭水| 常山县| 定陶县| 依安县| 喀喇沁旗| 洛扎县| 安图县| 宁波市| 沽源县| 明溪县| 珠海市| 伊春市| 正安县| 忻州市| 卢氏县| 碌曲县| 普定县| 中方县| 浦江县| 湄潭县| 和林格尔县| 嘉黎县| 桑日县| 甘孜| 岳西县| 长丰县| 临洮县| 库尔勒市| 民勤县| 高尔夫| 遵化市| 麦盖提县| 云安县| 吉首市| 吉木萨尔县| 北碚区| 天全县| 砀山县| 新营市| 札达县|