Question
X Code Swift Code - Binary operator '!==' cannot be applied to two 'Float' operands Coding: // // TRIViewController.swift // Calculator import Foundation import UIKit
X Code Swift Code - Binary operator '!==' cannot be applied to two 'Float' operands
Coding:
// // TRIViewController.swift // Calculator
import Foundation import UIKit
//class for TRI vie controller class TRIViewController: UIViewController { //text field variables @IBOutlet weak var OneTextField: UITextField! @IBOutlet weak var TwoTextField: UITextField! @IBOutlet weak var ThreeTextField: UITextField! //labels variables @IBOutlet weak var ResultLabel: UILabel! //viewDidLoad() function override func viewDidLoad() { OneTextField.text = "0.0" TwoTextField.text = "0.0" ThreeTextField.text = "0.0" super.viewDidLoad() } //function for button @IBAction func calculateButton(_ sender: Any) { //get and set each side length let One = Float(OneTextField.text!) let Two = Float(TwoTextField.text!) let Three = Float(ThreeTextField.text!) var Result: Float? //identfy the entered triangle if ((One! == Two!) || (Two! == Three!)) { ResultLabel.text = "The triangle is Equilateral" } else if ((One! == Two!) && (Two! !== Three!)) || ((One! !== Two!) && (Three! == One!)) || ((Three! == Two!) && (Three! !== One!)) { ResultLabel.text = "The triangle is Isosceles" } else if ((One! !== Two!) && (Two! !== Three!) && (Three! !== One!)) { ResultLabel.text = "The triangle is Scalene" } } }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started