SHARE
TWEET

Data Class as arguments

hazertothepast Jun 15th, 2017 (edited) 143 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. data class Person(val name: String, val age: Int)
  2.  
  3. fun doSomething(dataarg p: Person) { ... )
  4.  
  5. // Usage:
  6. doSomething(name = "John Doe", age = 25)
  7.  
  8. // OR:
  9. val john = Person(name = "John Doe", age = 25)
  10. doSomething(**john)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top