Skip to content

fixes/clarfication for hashes #11

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,11 @@ you're actually saying that the key to "bar" is a *variable* called foo, not the
Adding elements to a Map is easy:

```scala
val newHash = myHash + (anotherkey -> "another value")
var myHash = Map(key -> val)
myHash += (anotherKey -> anotherValue)

```scala
val newHash = myHash + (anotherKey -> "another value")
```

You can also easily join two Maps:
Expand All @@ -452,7 +456,13 @@ in this case, just like when you do it in Perl, any duplicate keys will point to
Deleting keys is also pretty simple:

```scala
myHash - "someKey"
myHash -= "someKey"
```

but when you would like to get a new hash without this element, use this:

```scala
val newHash = myHash - "someKey"
```

There's also a cool thing: we often want to fetch values from Maps or set a default. In Perl, you could
Expand Down