https://kotlinlang.org logo
#announcements
Title
# announcements
g

gildor

09/29/2017, 8:44 AM
Copy code
class test {
private var projID: String? = null
  fun main() {
  projID = intent.getStringExtra(getString("test")).also { projID -> 
       if (projID != null) {
          val proj = Proj(projID)
      } else {
          // todo
      }
   }
  }
}
c

Czar

09/29/2017, 8:46 AM
Copy code
fun main() {
    val proj = intent.getStringExtra(getString("test"))?.let { projId = it; Proj(it) } ?: //todo
}
g

gildor

09/29/2017, 8:46 AM
yes, it’ also depends what is
todo
2 Views