Why does Swift playground shows wrong number of executions?

回眸只為那壹抹淺笑 提交于 2019-11-28 12:50:13
Fluidity

It's showing how many times a function / expression is being called on that line:

since the calling expression (summer()) is on the same line, it counts as an extra operation. Hence, 6 prints + 6 returns + 1 summer() = 13 times something happened on that line.

I'm not sure if I used the correct terminology, but this is what's going on.

It's merely a consequence of the presentation:

21 //the result from the first time
(6 times) //the other 6 times

(7times) //all 7 times, including the 21 one.
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!