"fun x(var name:String)" doesn't be supported?

I found some Kotlin code from an open source project:


private fun checkFolded(var offset: Int): Int {
  val foldingModelImpl = editor.getFoldingModel()

  for(foldRegion in foldingModelImpl.fetchCollapsedAt(offset)?.iterator()){
  offset = foldRegion!!.getEndOffset() + 1

  return offset

It reports “var” in function parameters is not allowed. Kotlin doesn’t support it any more, does it? What we can do now to make it compiling?

You are correct, this is no longer supported. All parameters are implied to be 'val' and cannot be changed. You'll have to introduce a second variable to hold a changing value.

Thank you !