Making Converts out of Arrays

Going through an array and applying a code block is a staple of programming, so I’m particularly interested in today’s post on enumerable methods. #each One of the more commonly used methods, this, as you can probably guess, applies a given block through all of the items before returning the Array itself. The return is […]

[] vs .new with Arrays

Going through an array and applying a code block is a staple of programming, so I’m particularly interested in today’s post on enumerable methods. #each One of the more commonly used methods, this, as you can probably guess, applies a given block through all of the items before returning the Array itself. The return is […]

You Pick ’em! Selecting with Arrays

Going through an array and applying a code block is a staple of programming, so I’m particularly interested in today’s post on enumerable methods. #each One of the more commonly used methods, this, as you can probably guess, applies a given block through all of the items before returning the Array itself. The return is […]

Murder Mystery Night with Arrays

Welcome to a fun evening of deceit and murder at Hill House. #pop Like a revolver in a dining room, this pops off the last item in the array and shows you the body. victims = [“Yvette”, “Telegram Girl”, “Officer”, “Stranded Motorist”, “Mrs. Ho”, “Mr. Boddy”] victims.pop => “Mr. Boddy” victims => [“Yvette”, “Telegram Girl”, “Officer”,… Continue reading Murder Mystery Night with Arrays

Array Growth

There are a variety of ways to add items to an array. In the beginning… There was #unshift. If you want to add something in the beginning, use it. how_much = [“many”, “slams”, “in”, “an”, “old”, “screen”, “door”] how_much.unshift(“how”) => [“how”, “many”, “slams”, “in”, “an”, “old”, “screen”, “door”] In the end… You can always use… Continue reading Array Growth