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

python - mat is not a numerical tuple : openCV error -

c# - MSAA finds controls UI Automation doesn't -

wordpress - .htaccess: RewriteRule: bad flag delimiters -