in reply to Re^3: The joys of bad code
in thread The joys of bad code
A hash lookup? Why not an array? Anyway, i wouldnt have laughed so hard if it had been written something like the following:
Public Function GetMonthName(ByVal m As Long, _ Optional ByVal abbr As Boolean = False) As String Static Months(12) As String If (Months(1) <> "January") Then Months(1) = "January" Months(2) = "February" Months(3) = "March" Months(4) = "April" Months(5) = "May" Months(6) = "June" Months(7) = "July" Months(8) = "August" Months(9) = "September" Months(10) = "October" Months(11) = "November" Months(12) = "December" End If Dim tmp As String If (m >= 1 And m <= 12) Then tmp = Months(m) Else tmp = Format(m, "0") End If If abbr Then GetMonthName = Left(tmp, 3) Else GetMonthName = tmp End If End Function
---
demerphq
demerphq
First they ignore you, then they laugh at you, then they fight you, then you win.
-- Gandhi
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^5: The joys of bad code
by hardburn (Abbot) on Oct 26, 2004 at 18:30 UTC | |
Re^5: The joys of bad code
by Anonymous Monk on Oct 28, 2004 at 00:06 UTC | |
by demerphq (Chancellor) on Oct 28, 2004 at 08:11 UTC | |
by Golo (Friar) on Oct 28, 2004 at 14:21 UTC | |
by Anonymous Monk on Oct 28, 2004 at 14:26 UTC | |
by Anonymous Monk on Oct 28, 2004 at 14:28 UTC | |
by g00n (Hermit) on Oct 28, 2004 at 06:42 UTC |
In Section
Meditations