My app has a series of if statements. some of them a executed even when the condition is not met.
if viewModel.npH > 7.45 {
diagnos.resultado1 = "alcalemia"
print ("1")
}
if viewModel.npCO2 < 35 {
diagnos.resultado2 = "alcalosis respiratoria"
print ("2")
}
if viewModel.nHCO3 > 26 {
diagnos.resultado3 = "alcalosis metabólica"
print ("3")
}
if viewModel.npH < 7.35 {
diagnos.resultado1 = "acidemia"
print ("4")
}
if viewModel.npCO2 > 45 {
diagnos.resultado2 = "acidosis respiratoria"
print ("5")
}
if viewModel.nHCO3 < 22 {
diagnos.resultado3 = "acidosis metabólica"
print ("6")
}
For instance when i run it with viewModel.nph = 7.4, viewModel.npCO2 = 40 and viewModel.nHCO3 = 23.9 It prints "4", "5", "6" even though none of the conditions are met. I'm obviously doing something wrong but I can't understand what is it I' m doing wrong