- "preparagraph": "When calling methods and functions, you can use the name of the variables expliclty in the call, like so:\n\n```\ndef printName(first:String, last:String) = {\n println(first + \" \" + last)\n}\n\nprintName(\"John\",\"Smith\") // Prints \"John Smith\"\nprintName(first = \"John\",last = \"Smith\") // Prints \"John Smith\"\nprintName(last = \"Smith\",first = \"John\") // Prints \"John Smith\"\n```\n\nNote that once you are using parameter names in your calls, the order doesn’t matter, so long as all parameters are named. This feature works well with default parameter values:\n\n```\ndef printName(first:String = \"John\", last:String = \"Smith\") = {\n println(first + \" \" + last)\n}\nprintName(last = \"Jones\") // Prints \"John Jones\"\n```\n\nGiven classes below:\n\n```\nclass WithoutClassParameters() {\n def addColors(red: Int, green: Int, blue: Int) = {\n (red, green, blue)\n }\n\n def addColorsWithDefaults(red: Int = 0, green: Int = 0, blue: Int = 0) = {\n (red, green, blue)\n }\n}\n\nclass WithClassParameters(val defaultRed: Int, val defaultGreen: Int, val defaultBlue: Int) {\n def addColors(red: Int, green: Int, blue: Int) = {\n (red + defaultRed, green + defaultGreen, blue + defaultBlue)\n }\n\n def addColorsWithDefaults(red: Int = 0, green: Int = 0, blue: Int = 0) = {\n (red + defaultRed, green + defaultGreen, blue + defaultBlue)\n }\n}\n\nclass WithClassParametersInClassDefinition(val defaultRed: Int = 0, val defaultGreen: Int = 255, val defaultBlue: Int = 100) {\n def addColors(red: Int, green: Int, blue: Int) = {\n (red + defaultRed, green + defaultGreen, blue + defaultBlue)\n }\n\n def addColorsWithDefaults(red: Int = 0, green: Int = 0, blue: Int = 0) = {\n (red + defaultRed, green + defaultGreen, blue + defaultBlue)\n }\n}\n\n```\n\nCan specify arguments in any order if you use their names:",
0 commit comments