I am trying to just simply have a button you tap and it adds 1 to a label. If that label is below 3 print its below three. If it's above 3 print that it's above. This works up until 10 which then prints out it's below three even though the label still shows 10 or higher.
var counter = 0
@IBOutlet weak var count: UILabel!
@IBAction func testigbutton(_ sender: UIButton) {
counter = counter + 1
count.text = String(format: "%i", counter)
if count.text! < "3" {
print("Less than 3")
} else if count.text! > "10" {
print("More than 3")
}
}
Aucun commentaire:
Enregistrer un commentaire