Why does the for loop execute before the firebase code even though it is typed in after the firebase code?
messageDB.observe(.childAdded) { (snapshot) in
let snapshotValue = snapshot.value as! Dictionary<String,String>
print("Snapshot value \(snapshotValue)")
let email = snapshotValue["UserEmail"]!
if (email == Auth.auth().currentUser?.email as String?){
let user : UserString = UserString()
user.name = snapshotValue["UserName"]!
user.height = snapshotValue["UserHeight"]!
user.weight = snapshotValue["UserWeight"]!
user.date = snapshotValue["EntryDate"]!
userArray.append(user)
}
}
for index in 0...4{
print(index)
}