I get following error: "cannot assign to value: 'word' is a 'let' constant" I can't figure out why this happens. If someone could help me, I would appreciate it a lot.
Here is the code:
import UIKit
class ViewController: UIViewController {
var word1 = ""
@IBOutlet weak var label: UILabel!
func writeWord(word: String){
word = "Example"
}
@IBAction func button(sender: AnyObject) {
writeWord(word1)
label.text = word1
}
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
}