Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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

This comment has been minimized.

Copy link

@573f 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

This comment has been minimized.

Copy link
Owner Author

@greymeister greymeister commented Dec 8, 2014

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