例如,我想做current_month + 1.month
if语句true
if condition #i mean true
@month = Jan + 1.month #Feb
else
current_month #Jan
end
第一次迭代开始月份1月次年2月...etc
我的问题是如何保存更新后的@month供以后使用,并自动递增它
总之
我想写一个方法,它接受参数,如果它是真的,就会自动更新到下个月
发布于 2014-11-21 20:59:54
假设您在@month
中存储了一个Date
:
@month += 1.month if condition
如果condition
的评估结果为true
,则添加一个月。否则,让@month
保持原样。
这是你想要的吗?
https://stackoverflow.com/questions/27061822
复制相似问题