📅  最后修改于: 2022-03-11 15:04:42.255000             🧑  作者: Mango
[1, 2, 3].inject { |sum, number| sum + number} # 6
# 1 + 2 = 3
# 3 + 3 = 6
[1, 2, 3].inject(2) { |sum, number| sum + number} # 8
# 2 + 1 = 3
# 3 + 2 = 5
# 5 + 3 = 8