Ad
  • Custom User Avatar

    Oh my, please don't apologize! I'm learning a lot from this thread, and I think others are as well.

  • Custom User Avatar

    I agree that 'and' and '&&' have different precedences, and new programmers should not assume 'and' is just a pretty way to say '&&'. That doesn't make the solution incorrect. 'and' still short circuits, so both values have to be true in order for the method to return true. For logical evalutation, the two function the same way.

    The problem happens when, like your link says, in when you try to do control flow with '&&', assuming it has the same presedence as 'and'.

    For this kata, I really don't see a problem with this solution, but I 100% agree that ruby coders need to be aware of the subtle difference between 'and' and '&&'

  • Custom User Avatar

    @surajreddy thanks for the link! I assumed it was a prettier way of writing && and ||...I was way off!


    I'll keep that in mind when deciding to use &&/|| or and/or (I mean &&/|| || and/or haha..)