Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

travissarles
Copy link
Contributor

No description provided.


printName("John","Smith") // Prints "John Smith"
printName(first = "John",last = "Smith") // Prints "John Smith"
printName(last = "Smith",first = "John") // Prints "John Smith"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style: space after ,

prerequisite-knowledge: function-syntax
---

When calling methods, you can use the name of the parameters explicitly in the call, like so:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe provide instead of use?

println(first + " " + last)
}

printName(last="Smith", "john") // Does not compile
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

spaces left and right of =, uppercase John.

When calling methods, you can use the name of the parameters explicitly in the call, like so:

```tut
def printName(first: String, last: String) = {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unit-valued functions should have an explicit return type (also below)

println(first + " " + last)
}

printName(last = "Jones")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess you removed this example because it's in on a different page now?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Exactly

@travissarles
Copy link
Contributor Author

@heathermiller ready to merge

@travissarles travissarles mentioned this pull request Mar 17, 2017
33 tasks
@SethTisue SethTisue merged commit 109bc17 into scala:master Apr 4, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants