Ruby Programming – 6 – How to Write Arrays in Ruby

Today we learn about arrays and what they’re good for. Your adventure in programming is just getting started and it’s about to get even funner.



Twitter ►

YouTube ►

Facebook ►

SoundCloud ►

★☆★ NOTES ★☆★
Starting with this lesson you will begin to understand the ethos of programming languages. Do not worry if you don’t have a perfect understanding just yet. Going forward the pieces to the puzzle will begin to fall in place. We talked about this a little is the first and second episode; the need to keep pressing forward. If you ever feel a little confused on a method, do not spend too much time trying to fully grasp it. Just keep moving forward through the lessons. It’s in retrospect that you will begin to understand what these methods are capable of accomplishing. We will stumble upon instances that make you go “oh yes, I think I remember hearing something about this. I swear there is a way to do this.” That’s when you’ll either get it, or look around until you stumble upon that concept again. That’s when you pat yourself on the back.


Andy Chen says:

You really love sting more than string. lol. Very awesome videos though. thanks!

Adriana Castaneda says:

I’m enrolled in dev bootcamp and your videos are pulling me through it! So glad I found your videos!

Joshua K says:

sounds like you like dr. Pepper :)

Henry DeCoste says:

should we be memorizing everything as we go through each lesson, or is a basic understanding for each concept fine?

PSyCHoHaMSTeRza says:

You know of course you do not have to drag the file to the command prompt every time right? You can just press the up arrow and enter to execute the same file, even after it is saved.

RoTech404 says:

+Jacob Williams or anyone who knows. I’m trying to target certain letters within a target to capitalize. For example when i write mountain dew I want to target the m and the d to capitalize when i execute the variable. 

Akono Hite says:

Just getting into Ruby and your videos make everything easier to understand!  Thank you for this resource!

Yvigny Goncharov says:

It would be a Real Good Thing to have a condensed form of these tutorials for people who are already familiar with most programming concepts (I can see reasons for both, no argument).

I have been programming for a very long time, and, for me, you could cover these topics in 1/10th the time and I’d absorb it just fine.

No snub of people who need more time and input, it’s a matter of both experience and natural feel for programming.

MikeStar200944 says:

for -2 it gave me orange soda instead of dr pepper

CL Barillas says:

Hi Jake. I programmed in proprietary languages for years then quit to raise a gaggle of kids.  I’m coming back because it’s in my blood.  Your videos are excellent and very easy to follow.  Basic and easy.  Thanks for putting them up!

AnonymousWS Toft says:

I dont understand why montain dew is the in the [2] should it not be  coke?

Seraph's Embrace says:

I could not resist changing Dr. Pepper to Barqes Root Beer at 10:50.

Ramir Enriquez says:

Just want to thank you for making these very helpful videos and putting humor with them (yeah the sting one haha)

I’m a beginner in programming and ruby seems to be an interesting language to learn and you’re right, learning other languages is a good idea…  

transsexuality says:

Thank you so much for your videos – can you explain why soda_type[2] on line 10 returns “mountain dew” from the array and not integer 6? First I thought that the numbers added to calling an array referred to each letter, not each word, like soda_type[2] would refer to the “p” in sprite! But then when I realize they refer to the words not the letters I expected it to be the second entry in the array…but when I saw mountain dew I assumed it skips integers and sticks to strings? except then … why is Dr.Pepper [4] and not [3]??

Ash Cotton says:

Quick Question, I have noticed that sometimes you put $end at the end of your .rb files and sometimes you don’t. What is the purpose of $end? Does it only serve its purpose with certain script lines?

B BC says:

can you create an empty array in Ruby simply typing new_array = []

Devinci says:

Thank you! Helped out a lot!

Karina Kozarova says:

Can you upload all your vids into one?

Sean Maurice Perkins says:

Jacob,  thanks a lot for these videos. I am new to programming and your videos are making it really easy to learn Ruby! Keep up the excellent work!

Zsolt Boda says:

great one thanks. You might want to edit out the file pull ins. In linux console its simply up cursor.

Michael Condon says:

Why do you choose 1.9.3? I have a mac does that matter?

Lumina Chen says:

Wow the array can contains string, integer and float type data, I’m amazed yet a bit confused.. Haha I mean this ruby is very flexible than C++, who agreed with me ? And it’s kind of fully object oriented from the beginning, am I right ?
Wew exciting..


@ 9:21
Why wouldn’t you go with….

soda_type = [“sprite”, “coke”, “pepsi”, “dr. pepper”]
puts “Your favorite drink is #{soda_type[3].capitalize}”

=> Your favorite drink is Dr. pepper 

Not perfect but it takes less time and is cleaner.

Lewis Creelman says:


Ryan Zhou says:

Hey I love the sweet videos, very professional and entertaining. GREAT JOB!

-a usc computer science student

CodeBY says:

if u dont want drag and drop u can use up arrow key in command prompt guys 😀

LikeABousAblesGaming says:

What is the symbol/command that you would use if you just wanted to put notes there for yourself?

David Grantham says:

The puts “# (soda type[4]) tastes” doesn’t work for me. It still thinks its a string. I tried both { and ( with and without the space between the #

Danielle says:

I’m just learning ruby (previous dabbling with it over at codecademy) and never knew you could get a item in a array starting from the end of it. That’s awesome!

Joshua K says:

its understandable

kenneth 92 says:

Another way to put the plus sign is puts num1 + ” + ” + num2

Jeremy Wehrly says:

After working with the method in a string concept I found that it has to be the # symbol with curly brackets,
example: puts “#{soda_type[4]} tastes delicious!”. I could not get it to work with normal brackets. Maybe this was updated in one of the current Ruby releases? Thanks for the great videos.

Alexey Makovskiy says:

Great videos!

BurninRevolver says:

You are talking very slow, it is great for beginners anyway. Just for the fact, I am watching your videos at 1.5x speed lol

Write a comment


Human Verification: In order to verify that you are a human and not a spam bot, please enter the answer into the following box below based on the instructions contained in the graphic.

Do you like our videos?
Do you want to see more like that?

Please click below to support us on Facebook!

Send this to a friend

▷ Other ReviewsVehicles▷ Show Cars▷ Motorbikes▷ Scooters▷ Bicycles▷ Rims & Tires▷ Luxury BoatsFashion▷ Sunglasses▷ Luxury Watches▷ Luxury Purses▷ Jeans Wear▷ High Heels▷ Kinis Swimwear▷ Perfumes▷ Jewellery▷ Cosmetics▷ Shaving Helpers▷ Fashion HatsFooding▷ Chef Club▷ Fooding Helpers▷ Coktails & LiquorsSports▷ Sport Shoes▷ Fitness & Detox▷ Golf Gear▷ Racquets▷ Hiking & Trek Gear▷ Diving Equipment▷ Ski Gear▷ Snowboards▷ Surf Boards▷ Rollers & SkatesEntertainment▷ DIY Guides▷ Zik Instruments▷ Published Books▷ Music Albums▷ Cine Movies▷ Trading Helpers▷ Make Money▷ Fishing Equipment▷ Paintball Supplies▷ Trading Card Games▷ Telescopes▷ Knives▷ VapesHigh Tech▷ Flat Screens▷ Tech Devices▷ Camera Lenses▷ Audio HiFi▷ Printers▷ USB Devices▷ PC Hardware▷ Network Gear▷ Cloud Servers▷ Software Helpers▷ Programmer Helpers▷ Mobile Apps▷ Hearing AidsHome▷ Home Furniture▷ Home Appliances▷ Tools Workshop▷ Beddings▷ Floor Layings▷ Barbecues▷ Aquarium Gear▷ Safe Boxes▷ Office Supplies▷ Security Locks▷ Cleaning ProductsKids▷ Baby Strollers▷ Child Car Seats▷ Remote ControlledTravel▷ Luggages & Bags▷ Airlines Seats▷ Hotel Rooms▷ Fun Trips▷ Cruise Ships▷ Mexico Tours