Chapter 4. Using Constants and Enumerations

When you hard-code numbers in your procedures, a myriad of things can go wrong. Hard-coded numbers are generally referred to as magic numbers because they’re often shrouded in mystery; the meaning of such a number is obscure because the digits themselves give no indication as to what the number represents. This chapter discusses the drawbacks of magic numbers and offers alternatives using constants and enumerations.

Get Practical Standards for Microsoft® Visual Basic® .NET, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.