guard clauses

preview_player
Показать описание
my products:

work with me:
Рекомендации по теме
Комментарии
Автор

Chris, you've correctly explained the operation of guard clauses. However, the example provided in the video is clearly not well-chosen.
There's no point in adding such a check and returning false. It's simpler to just check

def negative?(value)
value < 0
end

ledockol
Автор

Sorry, but I think this video doesn’t explain guard clauses good to understand their purpose. Just come with some nested if statements that check for eg. min len 3, first char uppercase …., and then show how this case would be with guard clauses

qdbp