SHARE
TWEET

Untitled

a guest Mar 25th, 2019 66 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ### nil?
  2. ```
  3. nil.nil? # true
  4. false.nil? # false
  5. [].nil? # false
  6. {}.nil? # false
  7. "".nil? # false
  8. ```
  9.  
  10. ### empty?
  11. ```
  12. nil.empty? # throw error
  13. false.empty? # throw error
  14. [].empty? # true
  15. {}.empty? # true
  16. "".empty? # true
  17. ```
  18.  
  19. ### present?
  20. ```
  21. nil.present? # false
  22. false.present? # false
  23. [].present? # false
  24. {}.present? # false
  25. "".present? # false
  26. true.present? #true
  27. "abc".present? # true
  28. 123.present? # true
  29. ```
  30.  
  31. ### blank? (present? 的相反)
  32. ```
  33. nil.blank? # true
  34. false.blank? # true
  35. [].blank? # true
  36. {}.blank? # true
  37. "".blank? # true
  38. true.blank? #false
  39. "abc".blank? # false
  40. 123.blank? # false
  41. ```
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
 
Top