22 lines
450 B
Plaintext
22 lines
450 B
Plaintext
![]() |
include::../description.adoc[]
|
||
|
|
||
|
== Noncompliant Code Example
|
||
|
|
||
|
----
|
||
|
Public Function GetTitle(ByVal p As Person) As String
|
||
|
Return If(p.Gender = Gender.MALE, "Mr. ", If(p.IsMarried, "Mrs. ", "Miss ")) ' Noncompliant
|
||
|
End Function
|
||
|
----
|
||
|
|
||
|
== Compliant Solution
|
||
|
|
||
|
----
|
||
|
Public Function GetTitle(ByVal p As Person) As String
|
||
|
If p.Gender = Gender.MALE Then
|
||
|
Return "Mr. "
|
||
|
End If
|
||
|
|
||
|
Return If(p.IsMarried, "Mrs. ", "Miss ")
|
||
|
End Function
|
||
|
----
|