import UIKit
import Foundation
var FamilyOne = ["Sarah", "Female", "Granddaughter"]
var FamilyTwo = ["Isabel", "Female", "Granddaughter"]
var FamilyThree = ["Maya", "Female", "Granddaughter"]
var FamilyFour = ["Jean", "Female", "Daughter"]
var FamilyFive = ["Jennie", "Female", "Daughter"]
var MainArray = FamilyOne
var FemaleArray = ["Ava", "Mary", "Ann", "Carolina", "Jessica", "Emily",     "Elizabeth"]
var Photo = MainArray[0]
var SImage = UIImage(named: Photo)
var Gender = MainArray[1]
var Relation = MainArray[2]
class ViewController: UIViewController, UIImagePickerControllerDelegate,
    UINavigationControllerDelegate {
    @IBOutlet var image: UIImageView!
    @IBOutlet var label: UILabel!
    @IBOutlet var ButtonOne: UIButton!
    @IBOutlet var BUttonTwo: UIButton!
    @IBOutlet var ButtonThree: UIButton!
    @IBOutlet var BUtton4: UIButton!
    var SimageView = UIImageView(image: SImage!)
    override func viewDidLoad() {
        super.viewDidLoad()
        label.text = ("What is the name of your \(Relation) ?")
        SimageView.frame = CGRect(x: 67, y: 40, width: 240, height: 128)
        view.addSubview(SimageView)
        ButtonOne.setTitle(FemaleArray[4], for: UIControlState.normal)
        BUttonTwo.setTitle(MainArray[0], for: UIControlState.normal)
        ButtonThree.setTitle(FemaleArray[5], for: UIControlState.normal)
        BUtton4.setTitle(FemaleArray[2], for: UIControlState.normal)
    }
}
How can I put this code into a for loop and have it change "MainArray"'s value to FamilyTwo the second time the loop runs, FamilyThree the third time the loop runs, ect. ect.? When I put a for loop before the ViewController I constantly get the error 'Expression not allowed on top level'.
 
     
    