visibility - Scala - how to make val visible -
i have method
def example(something):something { val c=list() if(){ if(){ val a=list() } else{ val a=list() } } //here or b not declared c:::a }
how declare , make visible? i can not use var.
you can't make visible outside declaration scope, so, maybe, try this:
def example(somthing):somthing{ val c = { if (something) { (0 10).tolist } else { (0 5).tolist } } }
Comments
Post a Comment