Write an if/else statement that compares the double variable pH with 7.0 and makes the following assignments to the bool variables neutral, base, and acid: false, false, true if pH is less than 7. false, true, false if pH is greater than 7. true, false, false if pH is equal to 7

LANGUAGE: Visual Basic

CHALLENGE: Write an if/else statement that compares the double variable pH with 7.0 and makes the following assignments to the bool variables neutral, base, and acid:  false, false, true if pH is less than 7.  false, true, false if pH is greater than 7. true, false, false if pH is equal to 7

SOLUTION:


If (pH < 7) Then
    neutral = false
    base = false
    acid = true
ElseIf (pH > 7) Then
    neutral = false
    base = true
    acid = false
ElseIf (pH = 7) Then
    neutral = true
    base = false
    acid = false
End If