这样做很好:
q = case period_group
when 'day' then [7, 'D']
when 'week' then [7, 'WW']
else ['12','MM']
end
limit,pattern = q[0],q[1]
但我的第一次尝试:
limit, pattern = case period_group
when 'day' then 7, 'D'
when 'week' then 7, 'WW'
else '12','MM'
end
最终出现 SyntaxError:
syntax error, unexpected ',', expecting keyword_end
when 'day' then 7, 'D'
我错过了什么吗?