I empower people to become software developers, especially those with kids/family responsibilities, full-time jobs, or who feel too old to start over. 🥰👩🏽💻
Location
Washington DC
Education
Duke University | The Firehose Project (coding bootcamp)
First off, great post! I was worried at first that "David" was going to be unnecessarily critical of your PR, but it's awesome that his comments brought you to a number of useful refactors, and even better that you shared what you learned to help other new developers 😁
There's a subtle gotcha case with the or-assign operator, but it shouldn't occur in the context of this loop: let's say you have
The or-assign operator will take the falsey value* at something[:some_variable] and replace it with true. Similarly, the &&= operator will reassign variables that are truthy* (useful for cases like when you want to update values in a hash, but only if they already exist … and aren't false 😅)
*Rubyists love expressing ourselves in almost-words. falsey and truthy describe values that the double-negative patten will cast as !!foo == false and !!bar == true, respectively.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
ahhh yes you are right. Your comment finally made me go learn what "double-pipe equals" means in ruby 😄 so thank you!
Glad i could help :)
The
.presence
thing is also a nice shortcut that I wish came to JS one day :)First off, great post! I was worried at first that "David" was going to be unnecessarily critical of your PR, but it's awesome that his comments brought you to a number of useful refactors, and even better that you shared what you learned to help other new developers 😁
There's a subtle gotcha case with the or-assign operator, but it shouldn't occur in the context of this loop: let's say you have
The or-assign operator will take the falsey value* at
something[:some_variable]
and replace it withtrue
. Similarly, the&&=
operator will reassign variables that are truthy* (useful for cases like when you want to update values in a hash, but only if they already exist … and aren'tfalse
😅)*Rubyists love expressing ourselves in almost-words.
falsey
andtruthy
describe values that the double-negative patten will cast as!!foo == false
and!!bar == true
, respectively.