预设引数 ( default arguments ) 提供预设功能 >>> def eat(maxprice, lunch='chickenrice', soup='no'):
基于6个网页-相关网页
constructor with default arguments 带缺省参数的构造函数
Default values in arguments 参数的默认值
default template arguments 预设模板引数
Functions can have default arguments, as shown for the value argument of the compute function.
函数可以有默认参数,如compute函数的值参数所示。
Named and default arguments work hand in hand; one can pick a certain parameter by its name and use defaults for the others
具名与默认参数经常搭配使用,我们可以根据参数名称为参数赋值,同时对其他参数使用默认值,如下代码片段所示
Scala 2.8 also offers new language features, like the new named and default arguments. Named arguments look like assignments to the names of the called method's formal parameters
Scala 2.8还增加了新的语言特性,如新的 具名与默认参数。
应用推荐