swift - Expected Declaration error messages on empty lines -


i getting expected declaration error message on 2 empty lines , not know how fix them. don't understand why coming on empty line. here code.

var randomvalue = arc4random_uniform(15) + 1  var secondrandomvalue = arc4random_uniform(15) + 1   var firstnumberlabel: uilabel    self.firstnumberlabel.text = "\(randomvalue)" 

any suggestions on how fix problem?

try declare firstnumberlabel globally viewcontroller class this:

var firstnumberlabel : uilabel = uilabel() 

after can access anywhere have tried this:

import uikit  class viewcontroller: uiviewcontroller {  var firstnumberlabel : uilabel = uilabel()  override func viewdidload() {     super.viewdidload()     var randomvalue = arc4random_uniform(15) + 1     var secondrandomvalue = arc4random_uniform(15) + 1     self.firstnumberlabel.text = "\(randomvalue)"     } } 

may can you.


Comments

Popular posts from this blog

javascript - How to synchronize the Three.js and HTML/SVG coordinate systems (especially w.r.t. the y-axis)? -

javascript - How do I find how many occurences are there of a highlighted string, and which occurence is it? -

java - Reading data from multiple zip files and combining them to one -