DEV Community

Discussion on: Introduction to Linked Lists in Ruby

Collapse
 
ashutoshdevshali profile image
Ashutosh Devshali • Edited

Hi Megan, This post is really easy to follow and you have explained it very well. Just one minor mistake in find method:
return current_node if current_node.value == value
should come before
return false if !current_node.next_node
otherwise it will return false even if the value is of the first node i.e head
Why would you want to assume that the head is not the matching value?