我不知道如何把这个。我看到下面的语法在几个地方,像关于Ruby语法的困惑
def test
{
t: a,
h: b
}
end
..
def pieces
[
'the horse and the hound and the horn that belonged to',
'the farmer sowing his corn that kept',
]
end
我迷惑关于高清的语法。我知道这是功能,但何时使用{}以及何时使用[]。不知道它叫什么,所以我无法搜索互联网。 我有PHP的知识,不熟悉这种类型的语法。对于第一个,在PHP我会写如
function test ($a,$b)
{
$t=$a,
$h=$b
}
第二个,我会创建一个函数内的数组。
请帮忙。希望它是明确的。