Adventure time! Wait wth...

Different languages are different... surprise surprise.

# python

jar = []              # list

?> jar[0]
?  Error!

?> jar[0] = 'coin'
>  Error: No! You cannot!

jar.append('coin')

?> jar
?  ['coin']
?> jar[0]
?  'coin'

# Ok what else can we put in here?

file = open(".profile", "r")

bag = ['ticket', 'Canadian coin', 'pocket lint', file]
jar.extend(bag)

?> jar
?  ['coin', 'ticket', 'Canadian coin', 'pocket lint', <_io.TextIOWrapper name='.profile' mode='r' encoding='UTF-8'>]

burglesack = [thing.read() for thing in jar if hasattr(thing, 'read')]

?> burglesack
?   ['# You found a secret passageway!\nPATH=$PATH:$HOME/.local/bin']

#########

shelf = {}          # dict

shelf[‘foo’] = ‘bar’
shelf[0] = ‘baz’
shelf[23.01] = 'bat'
shelf[None] = 'omg'
shelf[False] = 'stop this!'

?> shelf
?  {‘foo’:’bar’, 0:’baz’, 23.01:'bat', None:'omg', False:'stop this!'}

?> shelf[‘oof’]
?  KEY ERROR!

?> shelf.foo
?  NO METHOD!
# ruby

jar = []              # array

?> jar[0]
?  nil
?> jar[1000]
?  nil

?> jar[0] = 'coin'
>  "coin"

jar << 'pocket lint'

?> jar
?  ["coin", "pocket lint"]

jar[20] = 'whoops'

?> jar
?  ["coin", "pocket lint", nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, "whoops"]

##########

shelf = {}          # hash

shelf[‘foo’] = ‘bar’
shelf[0] = ‘baz’
shelf[23.01] = 'bat'
shelf[nil] = 'oh no...'
shelf[false] = 'nonononono'
shelf[:cheese] = 'gouda'

?> shelf
?  {"foo"=>"bar", 0=>"baz", 23.01=>"bat", nil=>"oh no...", false=>"nonononono", :cheese=>"gouda"}

?> shelf[‘oof’]
?  nil

?> shelf.foo
?  NO METHOD!
-- lua

> jar = []              -- this is nothing.
  Erro! Eu não entendo!

-- Well let's see what we do have...

washtub = {}       -- this is a table. pretty much everything is a table.

> washtub[0]
  nil
> washtub[1000]
  nil

washtub[0] = 'coin'

> washtub
  table: 0x600003ecc140
-- oh fml (back in bash: luarocks install inspect)

inspect = require('inspect')

> inspect(washtub)
  {
    [0] = "coin"
  }

> washtub['apple'] = 'banana'
> inspect(washtub)
{
  [0] = "coin",
  apple = "banana"
}

> washtub.apple
banana
> washtub.water
nil
> washtub.0
stdin:1: syntax error near '.0'

> washtub[9999] = 'hope this goes well...'
> washtub[false] = 'eh?'
> washtub[22.01] = 'a'
> inspect(washtub)
{
  [0] = "coin",
  [22.01] = "a",
  [9999] = "hope this goes well...",
  [false] = "eh?",
  apple = "banana"
}

> washtub[nil] = 'hm?'
stdin:1: table index is nil
stack traceback:
	stdin:1: in main chunk
	[C]: in ?