class ViewController: UIViewController {
let questions = ["From what anime does the quote Lend me your energy come from?"]
let answers = ["dragon ball z", "Naruto", "One Piece"]
//Variables
var currentQuestion = 0
var rightAnswerPlacement:UInt32 = 0
//Label
@IBOutlet weak var lbl: UILabel!
//Button
@IBAction func Action(_ sender: Any) {
}
if (sender.tag == int(rightAnswerPlacement) (EXPECTED DECLARATION IS HERE)
{
print ("Right!")
}
else
{
Print ("Wrong!!!!!")
}
if (currentQuestion != questions.count)
{
func viewWillDisappear(_ animated: Bool)
{
newQuestion()
}
//Function that displays new question
func newQuestion()
{
lbl.text = Questions[currentQuestion]
rightAnswerPlacement = ((arc4random_uniform(3)+1))
//Create a button
var button:UIButton = UIButton()
var x = 1
_ = 1
for i in 1...3
{
//Create a button
button = view.viewWithTag(i) as! UIButton
if (i == Int(rightAnswerPlacement))
{
button.setTitle(questions[currentQuestion], for: .normal)
}
else
{
button.setTitle[answers[currentQuestion][x], for: .normal]
x = 2
}
}
currentQuestion += 1
func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
}