Ruby Essentials for Beginners (Part 01)

These videos are a series of lectures on Ruby that I gave recently in my programming languages course. While this is not a comprehensive guide to learning Ruby, we do discuss its salient features and compare it to other languages, especially Java and other languages with a C pedigree. In this particular video we look at defining functions/methods in ruby, return values, parallel assignments, and duck typing.


DontLeaveMeLucile says:

but what IS n? lol

Andrewc43 says:

You said for beginners although you reference C and other languages… Unless you solely mean beginners to Ruby with knowledge of other languages?

1whitemoon says:

I heard that in Ruby, just calling a method is a slow process. if that’s right, I’ll be forced to write less methods, and clutter code into huge methods. that seems to defeat the purpose of ruby being ‘readable’, with less lines of code overall, and eaiser to debug.
I’ve seen someone who made his Ruby program faster: from 20 seconds to just 1, by avoiding calling methods and some other tricks.. the thing is.. it didn’t look like the kind of program that’ll take 20 seconds to run, in the first place… can you please give an example, of how slow ruby is, for larger programs? will it actually lag your PC for like 5 minutes, or is it only a difference of a few seconds?

ehguacho2008 says:

for the record: 0! = 1 ;D

ibrahiml4satti says:

am trying to learn ruby…i’d love if u made it into a series

inc2000glw says:

i + want * his + brain = (genius)3.14

spongebobmx says:

thanks ! very helpful! Appreciate the effort

Kwintessential2 says:

Is this a CMS? Do you have to learn HTML first? How do content strategist use this program?

Ola Peters says:

Excellent teacher.

Thomas Slone says:

I made this useful pure ruby class, it contains syntax for doing lots of cool stuff like encoding files, measuring subdirectories, even calculating pi two ways, if you are looking for example code to get more aqquainted with ruby, then save this class source and have fun,

Douglas Allen says:

require ‘complex’ will do the polar for you. Complex(x, y).polar
>> Complex(3, 4).polar
==>[5.0, 0.9272952180016122]

Although it returns an array we can get the parts with indexing.

>> Complex(3, 4).polar[0]

>> Complex(3, 4).polar[1]

>> Complex(3, 4).polar[1] * 180.0 / Math::PI

And why are you typing return. Style and sugar is missing here old dude.

greg shubert says:

The second examples doesn’t return  anthing for me…??

Dilip D says:

#!/usr/bin/env ruby

class String
def to_int
self == self.to_i

argv.each do |a|
ar.each do |x| print x + ” “; end

puts “”

I have some error in this program can u pls correct the same

Christian Beasley says:

What about 0!  ? It equals 1.

Chris Celestine says:

Why didnt he just put *factorial(n)* in the *else* statement?

Joe Curcuru says:


amaterasu48 says:

There are some Ruby tutorials in YouTube and you are one of the best for those who already know at least one programming language. Thanks for putting this up! 🙂

rafalpilat145 says:

This language just dosent make sense. For eg. Why would you use “def” and “end” to open and close  a function, if statement, whille loop ect. Its alot faster to use curly brackets {}.Also, why is there no semi colons? You dont know where the statement is sobosed to end.

Jack Webb says:

elsif with a missing e but else does have an e.. Hmm? How is this fun for the programmer? That makes no sense at all, is hard to remember especially if you’re coming from another language.Habbits you know..  Every language I have ever seen uses elseif..  I just remembered why I haven’t bothered to learn Ruby.. It’s because like allot of popular languages, it tries to be too cute for it’s own good like Python.. Which is a joke literally as in Monty Python!

Nusret Balci says:

I like your pace and starting with functions.

Eric Eldh says:

That was a good explanation of the raise an exception at the beginning.
For me it made a lot of sense. I agree that ruby is dynamic and interpreted;
that is very nice.

spongebobmx says:

This is the best prep to Ruby video series! It just make you want to start throwing code at it! Thanks

 Write a comment


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

Please click below to support us on Facebook!