i've been struggling with this function here :P i hope someone could help me with it.
so my function retrieve some kind of data (double) from parse. the problem is i can't return the value of mark.
this is a picture of my error after updating the code : https://i.stack.imgur.com/UVeQG.png thanks in advance
func monday() -> Double{
let student:PFObject = currentObject!
let name:String = (student["student_name"] as? String)!
let query = PFQuery(className: "progress")
query.whereKey("student", equalTo: name)
query.skip = 4
query.getFirstObjectInBackgroundWithBlock{
(objects , error) -> Void in
if error == nil {
let mark = objects?.objectForKey("average") as! Double
print(mark)
// i want to return the value of -> mark
}
}
return query // error here : cannot convert return expression of type PFQuery to return type Double
}