This document discusses some common "gotchas" or surprises that newcomers to Ruby may encounter. It covers topics like truthy and falsey values in Ruby (only nil and false are falsey), the difference between and and && operators (and has higher precedence than =), that constants can be reassigned, and the differences between blocks, procs, and lambdas. The document is intended to help new Ruby programmers avoid surprises by explaining behaviors that may differ from other languages. It includes code examples to illustrate each point and provides references for further reading.
19. A pegadinha
Em Ruby só nil e false são considerados “falsey”
qualquer outro valor é considerado “truthy”.
20. Isso é útil?
address = ‘Rua Casa do Ator, 275’
address2 = nil # Famoso complemento
full_address = “Endereço: #{address}n
#{“Complemento: #{address2}” if address2}”