length()函數

length() 函數主要用來返回一個列表中有幾個值,簡單點說就是返回列表清單中有多少個值:

>> length(10px)
1
>> length(10px 20px (border 1px solid) 2em)
4
>> length(border 1px solid)
3

length() 函數中的列表參數之間使用空格隔開,不能使用逗號,否則函數將會出錯:

>> length(10px,20px,(border 1px solid),2em)
SyntaxError: wrong number of arguments (4 for 1) for `length'
>> length(1,2px)
SyntaxError: wrong number of arguments (2 for 1) for `length'

results matching ""

    No results matching ""