Skip to content

Instantly share code, notes, and snippets.

@greymeister
Last active August 29, 2015 14:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save greymeister/62bb7fe72c8d4d3d884e to your computer and use it in GitHub Desktop.
Save greymeister/62bb7fe72c8d4d3d884e to your computer and use it in GitHub Desktop.
Some Groovy Semantics I don't quite get
blah = [name: 'poop', status: 'tudus', null: 'EAD']
foo = 'name'
bar = 'status'
baz = null
println blah[baz]
blah.put(null, 'NOOBER')
println blah[foo]
println blah[bar]
println blah[baz]
@573f
Copy link

573f commented Dec 8, 2014

It seems the null in your first assignment is converted to the string 'null', rather than an actual null.

blah = [name: 'poop', status: 'tudus', null: 'EAD']
println blah['null'] 
EAD

@greymeister
Copy link
Author

Ah, that is interesting, I also didn't see a way to explicitly force null using the map syntax.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment