arbeitet Ich habe Daten wie: (id, Volumen, median.percantile)Visual Basic - meine String-Vergleichsfunktion nicht richtig
1 Normal Normal Low
2 Low Normal High
3 High High Normal
Was ich tun müssen, um einen Zähler haben, dass es um 1 erhöht, wenn Es ist nicht normal. So erwarte ich
1 Normal Normal Low Counter:1
2 Low Normal High Counter:2
3 High High Low Counter:3
Um es zur Verfügung zu stellen, schrieb ich die Funktion unten. Wenn ich jedoch dorthin (Normal, Normal, Hoch) sende, berechnet es 2 statt 1. Es funktioniert also nicht richtig. Wo ist mein Fehler?
Mein Code ist unten:
Public Function getPoint(ByVal volume As String, ByVal median As String, ByVal percantile As String) As Integer
Dim Total As Integer = 0
If volume = “Normal” then
total = total + 1
end if
If median = “Normal” then
total = total + 1
end if
If percantile = “Normal” then
total = total + 1
end if
return total
End Function
Ihre Antwort ist auch richtig, aber es wäre hilfreich, einige Kontext für das Problem der nur den richtigen Code stattdessen zu liefern. Lesen Sie [Wie schreibe ich eine gute Antwort?] (Http://stackoverflow.com/help/how-to-answer) – Spidey
danke für den Link! –