我如何从佣金任务中提前返回? - How do I return early from a rake task?

问题:

I have a rake task where I do some checks at the beginning, if one of the checks fails I would like to return early from the rake task, I don't want to execute any of the remaining code.我有一个 rake 任务,我在开始时进行了一些检查,如果其中一个检查失败,我想从 rake 任务中尽早返回,我不想执行任何剩余的代码。

I thought the solution would be to place a return where I wanted to return from the code but I get the following error我认为解决方案是在我想从代码返回的地方放置一个返回,但我收到以下错误

unexpected return

解决方案:

参考一: https://en.stackoom.com/question/9icV
参考二: https://stackoom.com/question/9icV
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章