Scala 初学者指南

Updated 2 years ago

Yuanfei Zhu (@yuanfeiz) started discussion #3

3 years ago · 1 comment


当一个 Try 是 Success 时, foreach 允许你在被包含的元素上执行副作用, 这种情况下,传递给 foreach 的函数只会执行一次,毕竟 Try 里面只有一个元素:

Try 与错误处理 (Edit this file)


No description provided.
Jiafeng Cao @windor commented 3 years ago

Yes, It's. I doesn't have time to review the files. Give a PR if you'd like to. Thanks.

Yuanfei Zhu @yuanfeiz commented 3 years ago

I was nitpicking the design of the language that reuse foreach among Option and Seq but with very different interpretations. The guide is pretty clear.

to join this conversation on GitBook. Already have an account? Sign in to comment

You’re not receiving notifications from this thread.

2 participants