So a co-worker (Scott H.) sent me some code that is purely fictional (but a sick part of me wishes I had actually found it in the wild).
Here's the code -
Public Function IsNotFalse(ByRef Value As Boolean) As Boolean
IsNotFalse = False
If Value = True Then
IsNotFalse = True
Else
IsNotFalse = False
Value = True 'Make sure Value IsNotFalse
End If
End Function
I think this is awesome. We need to add a few functions though. We need Obviously IsNotTrue. We also need some obscure things like MightBeTrue and MightBeFalse as well as MightNotBeTrue or MightNotBeFalse. Here's my implementations of these in VB <grin />
Public Function IsNotTrue(ByRef Value as Boolean) as Boolean
' re-use library as much as possible
Return Not IsNotFalse(value)
End Function
Public Function MightBeTrue(ByRef ParamArray arr() as Integer) as Boolean
Dim x as Integer
For x = LBound(arr) to UBound(arr)
If x <> 0 Then
Return true
End if
Next
Return false
End Function
Public Function MightBeFalse(ByRef ParamArray arr() as Integer) as Boolean
' re-use library as much as possible
Return Not MightBeTrue(arr)
End Function
Public Function MightNotBeFalse(ByRef ParamArray arr() as Integer) as Boolean
' re-use library as much as possible
Return MightBeTrue(arr)
End Function
Public Function MightNotBeTrue(ByRef ParamArray arr() as Integer) as Boolean
' re-use library as much as possible
Return Not MightBeFalse(arr)
End Function
Anyone see anything I missed? [I'm a moron... I put MightBeTrue twice... and I forgot the MightNots...]