title: Using variable from a function outside the function
body: <p>I want to use the variables UserFirstName, UserLastName and Numpts outside this function to put them in labels. Maybe I can put them in labels directly from the function but I'm not sure what's best.
  If more code is needed please ask. 
  P.S I'm a beginner</p>
  
  <pre><code>func parseJson(_ data:Data)
  {
  
      var actArray = [Activity]()
  
      do {
          let jsonArray = try JSONSerialization.jsonObject(with: data, options: []) as! [Any]
  
          for jsonResult in jsonArray
  
          {
              let jsonDict = jsonResult as! [String:String]
  
              let act = Activity (NumUser: jsonDict["NumUser"]!, cFirstname: jsonDict["cFirstname"]!, cLastname: jsonDict["cLastname"]!, cEmail: jsonDict["cEmail"]!, cPassword: jsonDict["cPassword"]!, NumPts: jsonDict["NumPts"]!, forgotpass: jsonDict["forgotpass"]!)
  
              if case (act.activityContainsString(value: "allo@allo.com")) = true
                             {
                              print(act.cFirstname)
                              print(act.cLastname)
                              print(act.NumPts)
                              let UserFirstName = (act.cFirstname)
                              let UserLastName = (act.cLastname)
                              let UserNumPts = (act.NumPts)
                              }
  
  
  
              print (act)
  
              actArray.append(act)
  
          }
          delegate?.itemsDownloaded(activities: actArray)
         }
      catch
         {
      print("There was an error")
         }
  </code></pre>
  
  <p>}</p>
  
  <p>I should be able to use my variables outside the function.</p>