Scala – mutable (var) method parameter reference

You can’t.

You’ll have to declare an extra var (or use a more functional style :-)).

Simplistic example:

def save(srcPath: String, destPath: String) {
    val normalizedDestPath =
      if (destPath.endsWith("https://stackoverflow.com/")) destPath
      else destPath + "https://stackoverflow.com/"
    // do something with normalizedDestPath 
}

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)