short circuit evaluation  

Ruby doesn’t look at both expressions unless it has to; if it sees

false && true

it stops reading as soon as it sees && because it knows false && anything must be false.

 
0
Kudos
 
0
Kudos

Now read this

I wrote merge sort in Ruby

I am learning sorting algorithms these days. And to me merge sort looks simple than other sorts. (There are merge sort, insertion sort, quick sort, selection sort, bubble sort, et cetera.) I thought I should try to write it in Ruby. The... Continue →