RDC00308 — Obsolete While…Wend
Severity: Information · Family: RDC (Rubberduck Core analyzers) ·
Raised by: ObsoleteWhileWendAnalyzer
A loop is written While…Wend.
While cond … Wend (MS-VBAL §5.4.2.2 While Statement) and Do While cond … Loop
(§5.4.2.6 Do Statement) test the condition before each pass, and are the same loop. Do While…Loop is the one that can be left
with Exit Do, and the one that has the post-test form (Do … Loop While) next to it. The diagnostic is an opinion of the analyzer and not a condition of the language: both are
legal.
The finding is the header of the loop, the keyword and its condition. It is a suggestion because changing the keywords does not change what the loop does.
How it is raised
| Situation | Example | Resolution |
|---|---|---|
A While…Wend loop. |
While n < 10 n = n + 1Wend |
Write it as Do While n < 10 … Loop. |
See also
- RD-VBAL §2.6.4 Rubberduck Core Diagnostics
- RD-VBAL §5.4.2.2 While Statement
- RD-VBAL §5.4.2.6 Do Statement
ACCUEIL • HOME | ℹ️ BIENVENUE • WELCOME | 🧩 BÂTISSONS • BUILD | RD-VBAL | SDK | 🌐 rubberduckvba.ca