Looks Like
var lastReading = 0
is defined inside a class (better add context code to know where it is defined). If that is the case, you're probably executing your block / closure in a different thread. So:
you set lastReading = 0
you launch some time-consuming task in another thread. The main thread (or the thread running that code) continues executing immediately. At the end of the block, you assign lastReading.
if you check lastReading just after the block, nothing
changes. Still == 0. That's because Main thread executes immediately and lastReading hasn't changed.
I'd better call a method to update lastReading at the end of the block:
var lastReading = 0
Query.getFirstObjectInBackgroundWithBlock(
{(data:PFObject?,error:NSError?) -> Void in
var dataEntry = data!
var Reading: AnyObject! = dataEntry["reading"]!
self.updatelastReading(Reading.integerValue)
})