Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Kotlin puzzler

Avatar for Gorita Gorita
March 17, 2019

Kotlin puzzler

interesting kotlin language quiz.

Avatar for Gorita

Gorita

March 17, 2019
Tweet

More Decks by Gorita

Other Decks in Programming

Transcript

  1. This session is 7 puzzles 01 1min ~ 1.5min
 to

    solve 02 interpretation 03 https://goo.gl/ejrMtw
  2. Purpose -Not a test -Save your debugging time -To understand

    kotlin language -For fun (remember easily) Before.. https://goo.gl/ejrMtw
  3. result: 1. a and b is equal:true 2. a and

    b is equal:false https://goo.gl/ejrMtw
  4. result: 1. a and b is equal:true 2. a and

    b is equal:false https://goo.gl/ejrMtw
  5. The compiler automatically derives the following members from all properties

    declared in the primary constructor: - equals(), hashCode(), toString(), componentN(), copy() https://goo.gl/ejrMtw
  6. Let’s talk about ?.let Use ‘?.let’ for null check? •

    Yes, you can. • But, checking null works with safe call ?. 
 not related with let https://goo.gl/ejrMtw
  7. Let’s talk about ?.let let, run, also, apply . •

    Expression • Scope https://goo.gl/ejrMtw
  8. Let’s talk about ?.let let, run, also, apply . •

    Expression • Opposite of Statement • Has returns • Scope https://goo.gl/ejrMtw
  9. Let’s talk about ?.let let, run, also, apply . •

    Expression • Opposite of Statement • Has returns • Scope https://goo.gl/ejrMtw
  10. If the expression to the left of ?: is not

    null, the elvis operator returns it, otherwise it returns the expression to the right. Execute expression to the left of ?: is null, Not ‘james.lover’ is null https://goo.gl/ejrMtw
  11. Need to check operator != first. Left expression of !=

    and right expression of !=. https://goo.gl/ejrMtw
  12. result: account is 1. empty. 2. . 3. null. password

    is 1. empty. 2. . 3. null. https://goo.gl/ejrMtw
  13. result: account is 1. empty. 2. . 3. null. password

    is 1. empty. 2. . 3. null. https://goo.gl/ejrMtw
  14. result: account is 1. empty. 2. . 3. null. password

    is 1. empty. 2. . 3. null. https://goo.gl/ejrMtw
  15. result: account is 1. empty. 2. . 3. null. password

    is 1. empty. 2. . 3. null. https://goo.gl/ejrMtw
  16. result: account is 1. empty. 2. . 3. null. password

    is 1. empty. 2. . 3. null. https://goo.gl/ejrMtw
  17. result: 1. Hello, my name is james 2. Hello, my

    name is 3. nothing https://goo.gl/ejrMtw
  18. result: 1. Hello, my name is james 2. Hello, my

    name is 3. nothing https://goo.gl/ejrMtw