所以这就是问题所在。我想从lastDate提取一个日期并将其放入nextDate,还要向变量nextDate添加一天。有人知道该怎么做吗?
| lastDate nextDate |
lastDate := Date
newDay: 10
monthNumber: 5
year: 2019.
nextDate := lastDate.
HELP HERE
^nextDate
这将有助于了解您正在使用哪个Smalltalk。
我将使用Smalltalk / X-jv分支作为示例,因为这对我来说很容易:
| lastDate nextDate |
lastDate := Date newDay: 10
month: 5
year: 2019.
nextDate := lastDate addDays: 1.
^ nextDate
要添加一天,您可以在#addDays:
中使用lastDate
消息。
编辑:由于评论
要添加年份,您可以发送消息#addYears: