BWeave Ramblings, maybe, when I get around to it.

Count takes a block

Ruby and Crystal’s #count can both take a block and return the number of elements in the collection where the block returns true.

[1, 2, 3].count { |num| num > 2 }
#=> 1

Count the differences between two strings:

string_a = "ABC"
string_b = "CDE"
string_a.chars.zip(string_b.chars).count { |(a, b)| a != b }
#=> 4