<p>In Ruby, what's the difference between <code>{}</code> and <code>[]</code>?</p>

<p><code>{}</code> seems to be used for both code blocks and hashes.</p>

<p>Are <code>[]</code> only for arrays?</p>

<p>The documention isn't very clear.</p>

Broadly speaking, you're correct. As well as hashes, the general style is that curly braces
```
{}
```
are often used for blocks that can fit all onto one line, instead of using
```
do
```
/
```
end
```
across several lines.
Square brackets
```
[]
```
are used as class methods in lots of Ruby classes, including String, BigNum, Dir and confusingly enough, Hash. So:
```
```
Hash["key" => "value"]
```
```
is just as valid as:
```
```
{ "key" => "value" }
```
```