dotnet / dotnet/vblang

[Proposal] Do ... End Do

Open
#36 1 comment 5 reactions 0 assignees View on GitHub
Discussion
Dominant language
No language data
Stars
328
Forks
71
PR merge metrics
No merged PRs in 30d

Description

A popular trick is:

```
If True Then
Dim myAutoVar1
Dim myAutoVar2
' etc.
' ...
' All done, end lifetime of myAutoVar*
End If
```

This is nice for keeping the number of temporary variables under control, and letting pithy names get reused nicely. The above works, but looks goofy. I'm proposing:

```
Do
Dim myAutoVar1
Dim myAutoVar2
' etc.
' ...
' All done, end lifetime of myAutoVar*
End Do
```

The End Do would work about the same as Loop Until True. Indeed the added benefit is that Exit Do and Continue Do can still be legitimate, so that one could exit the block early (a plus over the If True trick).

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.