[Proposal] improvements on the Iterator Function
- Dominant language
- No language data
- Stars
- 328
- Forks
- 71
- PR merge metrics
- No merged PRs in 30d
Description
Some times the Iterator function required early break, and in this situation the developer probably want to yield a value and early break the function. Then ``Yield`` and ``Return`` will be used. And I think that separate the ``Yield`` and ``Return`` keyword into two statement line probably looks terrible:
```vbnet
Public Iterator Function Blablabla(boo As Boolean) As IEnumerable(Of Integer)
If (boo) Then
' Yield value and early break this function
Yield 1
Return
End If
If blablablabls.... Then
' Just early break this function
Return
End If
' blabla
' Just yield value
Yield AnotherValue
End Function
```
Probably merge the ``Yield`` and ``Return`` into one statement can makes the vb code looks more elegant:
```vbnet
Public Iterator Function Blablabla(boo As Boolean) As IEnumerable(Of Integer)
If (boo) Then
' Yield value and early break this function
Yield Return 1
End If
If blablablabls.... Then
' Just early break this function
Return
End If
' blabla
' Just yield value
Yield AnotherValue
End Function
```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.