Kotlinの短絡評価について

 Kotlinの短絡評価について

1821636ac95415aa6e84bc33b394283d?s=128

tommykw

June 28, 2018
Tweet

Transcript

  1. $POOFIJUP*OD ϚϚͷҰาΛࢧ͑Δ ,PUMJOͷ୹བྷධՁʹ͍ͭͯ

  2. ෋ా݈ೋ !UPNNZLX !UPNNZLX ίωώτגࣜձࣾ"OESPJE&OHJOFFS

  3. αʔϏε঺հ ϚϚϦ

  4. ಥવͰ͕͢ɺ࣍ͷͭͷ,PUMJOίʔυͷҧ͍͕ Θ͔Γ·͔͢ʁ

  5. if (true || false) { } if (true or false)

    { }
  6. if (true || false) { } if (true or false)

    { } ಉ͡Α͏ʹݟ͑Δ͕࣮͸ҟͳΔڍಈ
  7. ͋Εɺ͜ͷ͕ͭಉ͡ҙຯͩͱࢥ͍ͬͯͨʜʁ if (true || false) { } if (true or

    false) { }
  8. ຊ೔͸,PUMJOͷ୹བྷධՁʹ͍ͭͯ

  9. ૣ଎ʮPSʯɺʮBOEʯͷίʔυΛ೷͍ͯΈΔ

  10. IUUQTHJUIVCDPN+FU#SBJOTLPUMJOCMPC NBTUFSDPSFCVJMUJOTOBUJWFLPUMJO#PPMFBOLU

  11. IUUQTHJUIVCDPN+FU#SBJOTLPUMJOCMPC NBTUFSDPSFCVJMUJOTOBUJWFLPUMJO#PPMFBOLU UIJTGVODUJPOEPFTOPUTIPSUDJSDVJUFWBMVBUJPO

  12. ୹བྷධՁ TIPSUDJSDVJUFWBMVBUJPO ͱ͸ʁ

  13. ୹བྷධՁ͸࿦ཧԋࢉࢠͷࠨลɺӈลͷධՁΛ ද͢ධՁํ๏Ͱ࠷খධՁͱ΋ݺ͹ΕΔɻ

  14. if (true || false) { } ୹བྷධՁ

  15. if (true || false) { } ୹བྷධՁ

  16. if (true || false) { } ʮUSVFʯ͚ͩධՁ͞ΕΔ ୹བྷධՁ

  17. ҰํͰ௨ৗͷ࿦ཧԋࢉࢠ͸ʁ

  18. ௨ৗͷ࿦ཧԋࢉࢠ if (true or false) { }

  19. if (true or false) { } ௨ৗͷ࿦ཧԋࢉࢠ

  20. if (true or false) { } ʮUSVFʯ͕ධՁ͞ΕΔ ௨ৗͷ࿦ཧԋࢉࢠ

  21. if (true or false) { } ʮUSVFʯ͕ධՁ͞ΕΔ ௨ৗͷ࿦ཧԋࢉࢠ

  22. if (true or false) { } ʮUSVFʯ͕ධՁ͞ΕΔ ʮGBMTFʯ΋ධՁ͞ΕΔ ௨ৗͷ࿦ཧԋࢉࢠ

  23. ௨ৗͷ࿦ཧԋࢉࢠͷར༻ํ๏͸ʁ

  24. IUUQTHJUIVCDPN+FU#SBJOTLPUMJOCMPCNBTUFSCVJME DPNNPOTSDPSHKFUCSBJOTLPUMJOJODSFNFOUBM *ODSFNFOUBM+WN$BDIFLU

  25. IUUQTHJUIVCDPN+FU#SBJOTLPUMJOCMPCNBTUFSCVJME DPNNPOTSDPSHKFUCSBJOTLPUMJOJODSFNFOUBM *ODSFNFOUBM+WN$BDIFLU

  26. "OESPJEͰͷར༻ intent.addFlags( Intent.FLAG_ACTIVITY_SINGLE_TOP or Intent.FLAG_ACTIVITY_CLEAR_TOP )

  27. "OESPJEͰͷར༻ intent.addFlags( Intent.FLAG_ACTIVITY_SINGLE_TOP or Intent.FLAG_ACTIVITY_CLEAR_TOP ) Ϗοτԋࢉͱͯ͠ར༻͍ͯ͠Δ

  28. +BWBͱ,PUMJOൺֱ

  29. ·ͱΊ

  30. w ,PUMJOͷʮPSɺBOEʯ͸ɺʮccɺʯ ͱಉ͡ҙຯͰ͸ͳ͍ w ୹བྷධՁͷ࿦ཧԋࢉࢠɺ௨ৗͷ࿦ཧԋࢉ ࢠ͕͋Δ

  31. ͋Γ͕ͱ͏͍͟͝·ͨ͠ʂ