Skip to content(if available)orjump to list(if available)

Variadic Switch

Variadic Switch

2 comments

·May 13, 2025

david2ndaccount

In D, you can just do a static foreach over a sequence to generate case labels:

https://d.godbolt.org/z/PxWEW14K1

PeterWhittaker

I find the article very interesting and informative but, honestly, of all of the approaches, I find the basic switch to be the most readable and likely the most maintainable, at least for this case.