An introduction to the Ruby Programming Language | D谩niel Ern艖 Szab贸 | Skillshare

Playback Speed

  • 0.5x
  • 1x (Normal)
  • 1.25x
  • 1.5x
  • 2x

An introduction to the Ruby Programming Language

teacher avatar D谩niel Ern艖 Szab贸, Pythonista in the making

Watch this class and thousands more

Get unlimited access to every class
Taught by industry leaders & working professionals
Topics include illustration, design, photography, and more

Watch this class and thousands more

Get unlimited access to every class
Taught by industry leaders & working professionals
Topics include illustration, design, photography, and more

Lessons in This Class

16 Lessons (2h 27m)
    • 1. Course Introduction small

    • 2. Setup and Hello World small

    • 3. Variables small

    • 4. Datastructures Small

    • 5. Loops small

    • 6. Branching small

    • 7. Functions small

    • 8. Exceptions small

    • 9. LambdasNProcs small

    • 10. Fiber small

    • 11. Threads small

    • 12. Gemming small

    • 13. Modules small

    • 14. Classes small

    • 15. MetaProgramming small

    • 16. Extras small

  • --
  • Beginner level
  • Intermediate level
  • Advanced level
  • All levels
  • Beg/Int level
  • Int/Adv level

Community Generated

The level is determined by a majority opinion of students who have reviewed this class. The teacher's recommendation is shown until at least 5 student responses are collected.





About This Class


Ruby is a dynamic, open source programming language with a focus on simplicity and productivity. It has an elegant syntax that is natural to read and easy to write. In this course you will get to be familiar with the fundamentals of this language. These will allow you to build more complex applications, and at the end of the course we will take a look at functional programming too, which is a pretty neat stuff.

The course has a source material in form of a github repository which you can find in the first video's attached resources.

My course materials can be found in my Github Repo:聽Ruby

Happy learning.

Meet Your Teacher

Teacher Profile Image

D谩niel Ern艖 Szab贸

Pythonista in the making


Hello, I'm Dániel Ernő.

I currently work as a devops engineer. I have several years of experience with various platforms and I'm here to teach some advanced techniques which may attribute your job security ;)



See full profile

Class Ratings

Expectations Met?
  • Exceeded!
  • Yes
  • Somewhat
  • Not really
Reviews Archive

In October 2018, we updated our review system to improve the way we collect feedback. Below are the reviews written before that update.

Why Join Skillshare?

Take award-winning Skillshare Original Classes

Each class has short lessons, hands-on projects

Your membership supports Skillshare teachers

Learn From Anywhere

Take classes on the go with the Skillshare app. Stream or download to watch on the plane, the subway, or wherever you learn best.


1. Course Introduction small: hello and welcome to my course on the Ruby programming language. Discourses an introductory course. And, ah, by the end of the course, you will be familiar with the fundamentals off what makes Ruby Ruby, and you will be able to write your own scripts and solutions that you face throughout your idea, professional career or university studies. Or if you just simply want to learn a new and very popular language that is widely used amongst the 90 professionals. This course is going to be for you. Ruby is basically an object oriented language, which allows you to, let's say, utilize the full arsenal off. Oh, people, which means object oriented programming. And apart from these, Ruby has another extension, which will be, let's say, discussed in another course mine, which is ruby on rails. That's for Web development. So here is what you can expect on this course. I have this get up page, and every material related to the videos will be uploaded here, so you will be able tow bro's it. Save it, try out the examples. Whatever you feel like to do and the course we'll start with a simple set up and hello world video, which is the fundamental off every course that I make and in general, so you always learn every programming like we starting with hello world. Then we are going to take a look at the variable types data structures, branching loops, functions, Lambda Brooks exceptions, object oriented programming and classes, fiber threads, gems. And we will end the scores with matter programming. So if you would like to learn this new language or just refresh your knowledge, I think this is ah, pretty good cause, of course, for that we are going to use the 2.5 on five version off Ruby. That's the latest stable. See you. 2. Setup and Hello World small: we're come to the set up and the hell a word. Part of this course in this video, we are going toe set up Ruby and the consul emulator that is needed. Apart from this, we are going to take a look at other sides, which are, let's say, important to Aruba developer. So if you go to the ruble lang, that or page if you find the download section and under the download sanction you will find , let's say this stable releases part, which allows you to download it. But if you are using Windows, you may want toe. Let's say, uh, install it with this ruby installer because that is ah, a little bit more different than on the nooks and micro s platforms. By the way, on, Mac Ruby comes with default installation, which is an older version, so you may want toe update it. Once you have downloaded, you just used the executed ball and, ah, it were taken off the installation. What we're using also in this course, is the commander portable common line or clothes or emulator for windows is a pretty neat tool. And ah, it allows you to have ah, let's a quick style consul emulator. So currently my mind is running. And if I use the whole key control f them, it is going to drop down and I can start. Ah, let's say doing whatever I want. I like this corns or because it comes with a built in line Exco months. So, for example, it has the wind, the installed. And if I say task that r B, it is going to open this file and what is kind off neat about it that it is going to have the syntax highlighting. So this is the best. You can exit this one with the colon W Q exclamation mark. So let's get back to the original part. Uh, we also have this ruby version manager and, ah, it allows you toe, let's say, install and manage multiple. You being their predators on the same machine. It might be important later on time. As you get more deeper into the programming language. The other side I want to show you is the ruby dog. That, or this is the de facto documentation site for Ruby and ah, you will find the answers to most of your questions here. If not here, then on stack Overflow. And you also have the ruby gems. That or and this is like the fight owns by that or so it is basically ah, um module or jump repository. And it allows you to search and download jumps from here. And, uh, technically, this was all about the introduction. Now let's see how we can create our first hello world program. I'm going to navigate to my ah documents folder and inside my ruby repository here, I'm going to show the whim. Hello, world that R p What I would also like toe value in this video is that physically there are two main ways you can print on the console. The 1st 1 is coming from the puts statement. So this is hello word from put and the other I want to show you is the print and we are going to take a look at the differences. So this is a hello world from print and with the plus sign we will cover later on course, you can can cut in +82 strings so hunted and this is going to be plus added, Let's save it. And in the women editor, what you can do is to use the colon exclamation mark to execute an external comment. And what I'm going to do is issued the Ruby Hello World that R B and what is going what it is going to do, he's, Ah, it's going to basically execute the commander, wait for you to type on enter or another common, and then give you back the script that you would like to edit on. And this is one if we remove the plus sign, which can contaminates the 1st 1 What we will see is the following. As you can see, if you did not come, Captain ate that one to the other. It is going to add it to a new line. So Poots has an implicit or rather explicit New Line character at the end off each string added so back flesh and the print is a little bit different. It allows you to print the role statement, so if you want a new line with that, you will need to explicitly are the let's say new line at the end. Off it in Ruby. It is also important to use comments and comments can be done in a single line, almost feline fashion. So if you use the hashtag, you can't say that this is a single line comment. And if you would like to have a mortar like commander, you would do it by this. So begin. And And this is, uh, Morty line Go, man. And that's technically what you may ah want to make sure is that you never do something like this so hashtag whatever or begin and then and and then in between, this is a comment, so it it will not be interpreted as you might think it will be interpreted. So if you want to come and something, make sure that you do it on the line where you do not have any statements for the interpreter itself. And ah, basically, this is all I wanted to show you. See you in the next video. 3. Variables small: welcome. In this video, we are going toe talk about variables and operators. So what he labels are in Ruby and in most of the programming languages are means to store either values or objects. And ah, Ruby, what you need toe take into consideration on the following. So let's create Vari Ables that r B here, we're going to start out with the mortal ankle meant bag him and it is, let's say fully or be compliant. So everything you're seeing Ruby has is on object and they usually have a super class. And the ruby supports dynamic typing, meaning that very able can refer to different types off objects during the execution off the script. So it is totally valid. If you say that a quiz stamp, you do stuff and then you say, equals string. What will be also does is a so called dark typing, which means that the how do I put this? So the walid semantics are determined by object types. So, um, there are different cases for that that we were covered later in this video, and ah Ruby also supports functional funk Shona and proceed your programming. The functional programming means that Ah, well, if you want to put this simple, you are defining functions and you defend script that cause sequence of functions and procedural programming means that you have layer off obstruction with the half off Opie. So object oriented programming. And you re present your problems with smaller objects that you can handle and that, ah, kind off. Have you solved the problem itself? It also supports reflection. Reflection means that ah Ruby doesn't need to know in advance everything that is needed for the scripts execution. So you can have Let's a script which takes on input without knowing what the type off that input is. And this is, Ah, very strong argument alongside to Ruby. And it also supports Mata programming. And we will end discourse with a small matter. Programming example. I will leave it here as a teaser, and it is by code in that prayer did. So That's kind of all about the main informations. And what I would also like to tell you is that Ruby there is a very important concept which is called scoping so scoping means and allows you to that's have a global and a local scope , so global scope means that everything that you define globally is available. Toe sub scoops and local scope is when you have ah, function inside which you define A very able sued at variable is only known to that specific scope. Ruby also supports in stance about a year both and ISS and also class worry Ebel's and you can define global valuables. And apart from this, you can also define constants. So it will be everything that you start with. A capital letter becomes a constant and ah, let's also kind of talk about different operators. So operators are basically something that allow you to perform specific actions based on the type off the object that you're working with. And that's me together. My notes Oh boy, I have dilated my notes. So let's ah, doors. What you have is logical operators, and this is the end and the or operators. What you also have is matematica more political operators. You have the plus sign the minus sign the multiplication sign that the divisions signed the modelo. The exponentially ations sign. You also have other arithmetic operators like equals less than equal greater than ekho does not e cool and so on. And now let's take a look at numbers. So boots numbers in a ruby. You basically have two types. The 1st 1 is fixed, numb, And the 2nd 1 is big, numb, big and ah, this is ah, kind off apart off the integer based class. So when you define a my integer as something like I don't know 9999 You can see that you won't want to put the my in teacher and ah, if you specify ah mother into jail which is something like whoa like this big the ruby is going to take care to toe convert between fixed, numb and big name So fixed now uses ah, smaller space in memory to store these numbers Big name has ah different underlying structure But the Ruby interpreter is going to hide this fact from you So wants your fixed numb or your very able which is an integer outgrowths the fixed numb the structure it is going toe Convert it to big mom and ah, you also have Oh, what have I have the number? Sarobi. You also have some float numbers on the float Numbers look like this. So my float make waas si 0.14 puts my float. You can have ah, complex numbers. So let's replace it complex. And we say that my complex equals to one e No, I don't know how much were you should give it 1.0 e five. And, uh, we can also have ah so called bullion value. So puts pool William and, uh, my bull can be either true 1/4 and ah, what is important in the bullion types off Very bus. We are goingto take a look at so Ruby Bari a bus. Let's give it a test run Cool. And ah, if we want, we can start the interactive ruby shell. So when you are working with bullion body able, you will see something interesting You can call the class off this And as you can see, this is called true class. So when you define the value s fourth, you will see that this is 1/4 class. So that is ah different object representing these kind off values. And you can also issued the super class on the spot. You will get the super class of the force class and you can also issue the super class on this, which is going to be a basic object and the super class off every basic object is meal. And let's get back to our Ruby script and does something really fun. Enter strength dash T strength. So my strength equals learning. Ruby is really fun and I'm going to create account. Are you able? Which is going to be my string that split? And we are very dispirited by Why? Why? It's space and we will get the count property or attribute off the result. And I'm going to say that I would like to print this statement. So this statement words Ah, what is a hash tag? Count? Word hashtag count equals one question mark dot Golan s book and ah, let's save it and run it Ruby variables, not RB. As you can see, the statement or statement holds Sybers, let's correct it to centres. But technically we are going toe Inspect what happened here. So symptoms holds and what happens here is that we split the string by the white space character and hold'em and then the resulting objects count attribute is saved into our new variable, which is going to be an integer and then we are going to use this literal substitution which is presented by the hashtag and curly brackets. And then we are going to have a short hand if else And this means that if the Count Vari ables value is one, then we are executing war, ending the dot to the string. Otherwise, we are adding the as dot and ah, what ask can you do with strength? Let's ah, jump right back to our Irby Consul And we say that my string equals two the ruby his fun and this my string at least the functionality that is provided by the string class can be inspected by the public methods and everything that you see here is going to be either gullible function on that string or something that allows you to let's say, perform actions on this string. Let's say we would like to call the up gays on this string. You can see that it converted everything to upper case in our ruby Ah string. You could also say that too, see and this is going toe convert it to characters. And ah, you could also say that you would like Toa have the I don't know, count not count. It should have something. Well, Trump, this is also very important. But so trump can be used when you would like to. Let's say the read from the ah input and ah, story it in a very able, very able equals gets and this waas got. And you can see that this variable is ending in a new line character. If you call the very able jump, it is going to remove the special characters from the end off the string that you have got . So we have basically dogged about everything that I wanted to tell you about Very a bus in Ruby. See you on the next to do. 4. Datastructures Small: Welcome back in this video. We're going to talk about the structures in Ruby and we will start out with Ah, let's say Morty line comment. So begin. And And there are two main types of data structures in Ruby. The 1st 1 is array. The 2nd 1 is hash. There are two other types. The one is called a new Maria bow. The other is range. So what? Ah, uh, I'm going to explain it later in further detail. So array equal still brackets. And this is how you define Nannery and hash equals two curly brackets. This is how you define a hash. But how do we feel them with values? So when you are working with an array, what you can do is to up values to disarray. And you say you want to a date with this? Ah, double duck signs and the you cannot values off different types to this Very And it has no problem technically with this. So hurry. Um, let's give it the four 0.0 e. Five Onda array five. And if you want, we can print our array. Now, let's ah called script. So as you can see, we have added values to this ray. Now, what you can also do is to define these values in advance. So if you go like this, so want to three 45 it is going to initialize your way by this, you can also do Ah, that's a custom array which will be defined the following way already like you five and one . And if you print, uh, ask give it puts on, give it a print custom, okay, and run it. So as you can see, this array was initialized by five ones. So the first in this constructor is the amount of elements that you would like to store in the area, and the 2nd 1 is the value off these elements. You can also define a multi dimensional array, some multi dime. And it would go this way. Hurry that you We would like to have three ah columns, and I agree. But new three rows and these rose should have the one as the foot value. So boots print Morty them. Let's save it and run it. As you can see, we have our own multi dimensional array ready and waiting for us to be used. Eso Let's get back to hash. And this hash is very interesting because the closest to it, you can get its ah dictionary. So in dictionary, you have the words and their meanings, and this is an obstruction over that. So basically in the hash, what you have is the let's define it here. So we will have the language and this is going to be the key. And the value of this is going to ruby. Diversion is going to be 2.5 point five and the level is going to be easy. And if I go back and ah, use the puts brain hash, I will see the following output Voice expecting and a Finn. But what today? Hold up. So no, we go as it got C. This is how the dictionary it looks like and what you can do here in the dictionary is the following. You could say that you want to get a specific key keys value from the dictionary, so hash language. You could also say that um, you want to get to see if the has key returns. True for the version, let's save it and let's give it a test run. So it has the value for the key language, Ruby, and the has key is true. So what you can also do is to inspect what are available functions and attributes in case of the hash or the ray I use. So let's say our hash looks like this. What you can do is invoked the public methods and this is print out all the available metals that are available on you on the state of structures so you could have the keys, the merge, delete value and so on. We are going to talk about later in this time in time about these question marks and exclamation marks. Let's get back to our data structures and we are going to take a look at Annamaria Bus. So animal a bus are something Ah, that are made up off data structure that implements specific method that makes it enumerable. So in this case, what we can do is tow. See what happens when we want to enumerate my array. So hurry that map and we would like the map the value to value times five. And if we print this, what we were see is the following it. It is interesting because my ira holds Add meaning in teachers, then strength, then afloat and so on S So what happened here is the The integer was motive placated by five times the string was going gettin a tid to itself five times and ah, this is what this Annamarie about it a structure allowed you to do so the map It was a function that we called on each value specified by the very able and ah, this my function Ah, that's a ah resulted in the more typically more dip lic ation off the values off my A What we can also do is to let's say are a that thought and this ray sort is going to result in the following. Uh, it is an error which is totally natural because it cannot sort a string and the nature. But if you had only into your part So let's say are a on and we would like to have the oh point point five, it should be able to sort it. And there you go it sorted it. So that's ah kind of fall about the animal. A bus, what we owe Let let me give you another pretty cool example. So let's say you would like to get the even numbers from your way. Oh, you need to do is use the select and you would specify that the value And if the value is even and there you go, you can get they even values if you are using memory, which has the appropriate values, too checked if they are. Even so, we would like to use zero point point five. So the subs set off the this specific array, and now it is working so we can see that we have to even values in our three. Now let's get to the range part. So range is a very interesting thing in Ruby. It allows you to dio Ah, let's a kind off, kind off interesting things. So that's the Annamaria boom. So the closest thing to ah range so range. So the closest thing is the four like it oration over the set off elements. And what I mean by this is the following. When you have this Ah, let's a specific range. You could do the following. Let's say our range goes from 1 to 10 and we would like to multiply the values off this. So what we would do is the following value value times them. And now if you run our script, we can see that each and every element Waas Ah, let's say more deployed by them if we want. We can also use inclusive range. So puts Brent one point point point, Stan, map and V and V times three. So, I mean, I should not have deleted thought from here, but this is how it kind of looks. So the first range is going to go from 1 to 10. The second rage on range only goes from 1 to 9. And there might be some situations where it would be kind off. Nice to control how further the functions go in regards to specific arranges. Um, technically, this was all I wanted to tell you about this topic. Thank you. 5. Loops small: Welcome back in this video, we are going to talk about loops in Ruby, so let's get to it loops that are be. And there are basically a few types off loops that are available. That is why I look on until loop A for loop and a loop. You also have, ah, special control statements like Break Next and what's the 3rd 1? Or for a minute Redux? And, uh, I'm going to demonstrate each and every one of you one of these for you. So with four loop, it's, ah, the most convenient to anima rate over a new variable data structures. So, like a raise or hashes. So let's give it this array, and we would like to put for I a course hashtag all right, and and we can also I am and the range one that that then puts for range. I equals I. So that is also construct for using this four loop with Oh, don't so you can use it with, ah, start where you and the n value. But in my experience, it's ah more convenient to use the let's a while or anti loops for such constructs. So let's see what do I look has to offer? We will have the value with zero and we say that while I is less than 10 we would like Toa bring the wine I equal hashtag I we don't forget to incriminate the value so it does not become an endless loop and if we run it, we can see this on the output. So before every execution off the loop body, it is going to check deceive the condition is through and if it's true, it is not going to execute the lower body. Now let's see what the anti loop has to affirm. So I equals zero until I is greater than 10 boots until I equals hash tag, all right. And I plus equals one and we just stand it. So, uh, as with the anti loop, the difference between a while and then the loop is that in case of the anti loop ah, you are going to evaluate the let's say breaking except ex Ah, the breaking part with after the nobody was executed. So that's why you see one more values. You can also have ah so called loop loop, which which is ah defined this way So we will have this infinity I pick Waas plant on and and we say that if I is greater than 10 we would like to break out from the slope. And now if you're on it, you can see that this did not break out because we have forgotten toe Let's say increments the value off the I. But now since we have incriminated, you can see that this is working. Now that is also special construct for loops. The special construct is the begin and block. And let's say that while I is less than one, we would like Toa puts the begin and I a course hashtag I I bless Equus one and we just give the I and the value zero. Now, if you run it, you can see this is kind of the output off the roof value and let's see the other break next and reduce statements. So mm, what? Ah, we would like to do s two. How do I don't want straight this for you. So the base statement you are already available there off. So if you use the brake statement is going to stop the execution off the loop. If you would like you could use the next statement. So if you have a loop like this for I am ah, range one point point. Damn! And we say that if if If if I up even question Mark, then we say next and otherwise we would like to put I It was too Hi and we just end the slope. So what happens here? As you can see, this is going toe print the old number So the next means that whatever is after eso if he entered this if condition then whatever is after the if definition is going to be ignored because the execution jumps back to the beginning off the group. What? You could also say that you would like to use the redo. So for I in ah, that's ah three. Let's ah create Ah aloof That is going to read numbers and we would like to have three numbers. So while I is less than three, we would like to get the number so puts enter a number and we say that number is equal to gets That too. I the two I means that we would like toa converted to integer and, uh if the number is an e teacher than we are good to go. Otherwise we need toe. Let's say redo the execution off this specific loop. So, uh, we say that we do if the number is less or equal to zero. And otherwise we would like to increment with one dewie loop. So let's end it. And we say that books God, the I plus one number number. And we used the hashtag here. Now if I granite who ran the slope, you can see that I enter for God uh, one and the three and enter too. So it only accepted the y value. Which waas Ah, kind off An acceptable number left me Remove this. And, uh technically, I think this was all I wanted to show you about this topic. Thank you. 6. Branching small: Welcome back in this video. We are going to talk about branching and what you can do with it in Ruby, so branching that are being first. Let's see how we can implement the statements. So let's say we have a variable which is called Count, and we say that if count greater than them, we would like Toa put This is bigger, then them, as if count less than them. We would like the puts. This is less, um, them, as we would like to put whatever is remain. So it's it's not bigger or less than this is them and we close it with the end statement. If you run the branching, you can see the output says that the system what you can also do in Ruby, the disconnection us is toe assign the return value, so result equals two. If you count is less than them. We will say that this is less than that, as if count greater than them and we do not need the puts statement. So this is greater than them, as this is them and and we would put the result is and we use this substitution result. Let's save it and run it. So the result is this is a man. Now what you also have is the case statements okays count When the Countess stem Then we would like to put the result is done when 11 then books. This is 11 and we also have This s part where we say, Whatever happens, if you don't much the one cases you need to return this. So this is other than expected and we need to close it with the end statement. Now, if we run this, you can see that if I modify my account's value to 99 we will see Diaz branch executed. And we can also assigned the value off this case statement over at least a return. And, uh, we don't don't really need toe specified the puts here. So result make was still case count when them This is them when he left him. This is 11. Have This cannot be end and puts the result is and result. Now, if you save it and execute it, we can see that there is an arrow here. Hold on, let me check. So the kiss on a now save it and executed as you can see when you don't specify the dance statement, you need to put this result to a new line and you also have so called unless conditioner. So let's make the count 25. And we say that unless count is less than 25 we would like to put this is bigger than 25. So what happens here? What happens is that it acts as if we have negated the condition which was evaluated here. So if you could ah, translated that if not count less than 25 which makes that true So the value is greater than 25 then this is the result here. What we have you can also conditionally a sign. Ah, values initial is very ables And uh, you could ah put output. So this is bigger if count is greater than 24 And what you can see that this is bigger has reached a deal. But so it was evaluated true and we could also reverse this. So this is bigger unless count is less then 24. And now if he executed, you can see that this is bigger appeared once again. So technically Ah, this is, uh, almost everything that I wanted to show you. What you could also do is when you initialize very able, you simply say that ah result conditioner equal. And this conditional equal will be used in the following part. So uh huh Bigger unless count is less than 24 and we say that boots the result if and we swap it out so resolved now, if you save it and run it, you can see that this is not working because you cannot have a white space in here. So this is a conditioner initialization and on what happens here, is that the reason If the results was not defined previously, it is going to define it. Otherwise, what it is going to do is simply, let's say ah, ignore this expression. So this is a conditional or initialization and you can have this conditioner and initialization. So if you spot a flop it out, the results here is what happens. You can see that the result is bigger. This waas evaluated here and ah, technically I think this is all I wanted to show you. Thank you for 7. Functions small: what? Come back in this video. We are going to take a look at functions, see Ruby and what you can do with them. So that's great. Our script functions that are be. And let's say we want simple function which escort hello and we were just simply issued a welcome to my Ruby course him, and we just simply invoked this hello function. Let's save it Ruby functions that are be so I have for gotten toe had d o at the end. But now if you really run it, as you can see, it says that Welcome to my ruby course. So every function a ruby has returned about you. If you do not specify an explosive return value than the last one last statement executed based on its return value, it is going to be returned when you call this function. So that's a equals Hello and we want to put a What you can see here is that there is nothing on the output because when you invoke the puts command. So let's take a look at an example in the interactive Rudisha. So hello. As you can see, Neil is the return value. And if you print Neil, then you get nothing. And ah, technically, that's about it. What you can also do is ah toe Let's do it this way. Death class. If you return it, it will become obvious that this is a near class so near was returned. Now, if you want to change it so death Hello And we just simply do the welcome to my Robbie. Of course. Oh, I'm missing a Why here. And if we end this function, what we can see when we call it is the following be it Waas Hello puts be So when the function it's half is executed, you will not see the oath But because that string is returned by the rules off Ruby to the caller And this is why this puts me gives you whatever waas returned there. So, uh, that's ah kind off as a basis toe the functions. What you can also do is to create functions with arguments, so won't apply a b on. We just say a times B and, um, we closed this and we say that C equals multiply then 20 and puts see equals hash tag See, which is, uh from times 20 Let's save it and run it. So seize 200 which is 10 times 20 and I'm missing an h here. But you can also do is to create a function which takes que a documents so more deep plie star and arguments. Now, if he wants to return the arguments, we will see the following so d equals more reply. Ah, let's call it he would arguments not multiply. So it's not confusing. So Quirk's and we say that a Karlan damn be golden 20. And we say that puts the Now, if we run this script, we will see the following. As you can see, this hash was returned which was passed a ski world arguments. You can also makes these arguments so push position now and Cheever documents bush and quarks and we say that we have the A and dick works. And now what we can do is returned one not return. Just simply say that puts a call them all of equals. Hey, puts clogs. And now what we can do is to call the push on and quirks with the then and ah a colon. 20 be called him 30 see Golan, 40 and Now if you run our functions Portia and corks now save it and run it. So you can see that this argument waas correct which was passed. What you cannot do is that you proceed the position argument with keyword arguments because in that case you will have an exception which will be the next video stopping. So you cannot proceed the position arguments with, uh, keyboard arguments. That's, Ah, an important rule that you need to keep in mind. What you could also do is ah, define a specific program block as argument and what I mean by this is the following. So let's say we have function that that would wrap another function court. So we say that deaf rock back and ah, this rapper is going to say that starting execution off block and yield is going to transfer the control to the block and and off execution off. Look and and let's ah, create function So ver up bad do puts Ruby is school end. And now when we let's say core this rapper, we will see the following. It says that it is starting the execution off the book. The execution was yielded to the block. Then the execution was transferred back to the block. This allows Mawr complex and the more suffix sophisticated the execution in European application. Thank you for watching. 8. Exceptions small: welcome in the city, or we're going to talk about exceptions and how you can handle them. You'd be. So let's create the exception that are be. And what is the most important thing that you need to understand are the following keeper. So you have the rescue the and Shore Pandey, as so the risk you, Mieze, that ah, the flow of the execution changes when a specific type of exception WAAS got so rescue is for catching the exceptions, the S is going to be executed when there were no exceptions and the ensure is going to be executed anyway where the whether there were any exceptions or not. And the other thing that you need to understand or which is important, is that every exceptions base is the exception them. From that you will have the standard at all and the run time adult and you will need toe. Let's say, catch exceptions accordingly. So let's create ah demo function, and the cramp demo function is going to try to read uh five, which will not exist at the moment. So enough read fine and we will say that the five equals five not open, non existent and we will say that in case ah often exception. We would like to, let's say rays ah specific ad or with a message and then what we would like to do. It's too, if the exception was not raised to say that it was true what we return otherwise, we would like to rescue the following the system called at or were mean that this was unable to find the let's say file that we are looking for open and we was returned force. And then, as we will say, that there were no exceptions. And the onshore we mean that I was executed anyways and now we can end our function cool, and we were just simply call the read five Now if I save it and issued the Ruby exception or be you can see that there were not much messages, so to speak. So if we put something here in the force, so puts exception has acute hash tag e, we will see what was the problem. So no such file or directory non existent. And the minute that this fire comes to exist, so that's just simply but five. Well, that's it. Let's even put something in there. So women this exist and save it and we will see that in case the fire was successfully read , we were say that fine waas red or at least read or O Bannon. So Roby exception refi constant terror What in the seventh line So sad, Noma, You know, hold on for a second. So exception in the 19th line line seven un initialized constant your name 12 or 34567 is system called arrow Good given zero Expected 123 So gold opened five. And now if we execute our script, we can see that there was this error said that it could not open the file. But if I remove this because the fire already exists water you will see is that the five or threat or open So you can raise this exception to test the catching off the specific exception. But, uh, let's ah, try to read the actual values. So five a threat or opened hashtag brackets fire a treat. Cool. So this is the context off the context off the file. What you could also do in Ruby is the following. Let's see, you have ah um ah, you have the file that you expect to be able to read in case it was put in a specific order folder. So deaf read if present. Then what we would like to do is to, uh, have the fine equals file, but open. And, uh, we would like to call this a know that non exes stand and we will ah say that we want to rescue the system called adult. He and we say that an exception has a cured and, uh, we return this force. And otherwise, what we would like to do is still say that the five waas red successfully and see the content off the fire is the following and ensure books this waas completed. And and we would like to make sure that we are going toe have this so called retry or attempts. And ah, these attempts are going to be done the following way attempts equals zero at them plus equals one. And if the attempts is greater down three, we will say that or sorry. Last time three, we will say that trying again otherwise we would like to raise boots failed to read, really raising the exception and, uh, let's try to run it once again. So we are going to need toe modify the spot so the end is also going to need to be or Dave needs to be closed, and we need to read if present. So as it said that there were no exceptions, that's from the previous comb and them trying again, trying again, Faith read re raising exception. Now, if we exit from here and say that I'll be we can check that the time has asleep function and ah or wait All right, then we will not go this direction. So what happened here? What we did, we tried to read the file which was not existent. And we catch this system called ad or and the system called at or is going toe say that this file is not available because that was an external call. And, uh, let's bring this message as nice as possible. And this is the conditioner definition off. A very able. So when the first executes the value of the attempt is Neil so it is going to have the value of zero, then it seems that exception a cured we are going to increment it with one then if ah, we are less than the allowed attempts we are going to retry to read that file. Otherwise we will say that we have fair to read five and this re tries going toe be the one that, let's say, returns to the beginning off the functions execution And, um what ah we could also use here is the following. So let's see, if I didn't mess this up too much shall returned. Cool. And we will just touch another non existent. And if you run it once again, cool. The fire was red, but it's empty. The demonstration is kind of good. 9. LambdasNProcs small: we'll come back in this video. We're going to talk about Llamas and Brooks. So Lamb Bus and Brooks are a very interesting breed in Ruby. They are lets it go on, throw a statement and ah, let's call it London's and blocks that are be so when you are working with a lumber function what you are need. What you need to take into consideration is the following in London function. What you have here is that it's strict about arguments. It is also going toe. Ah, let's say Ah, return to the caller. We will demonstrate this when you are working with Brooks. It is not strict about arguments and it cannot return. It will always run in the highest, took most level off execution. So let's define a function. Um, be the recourse, lambda and we will have this block definition and say that message. It is. I am alarmed and this is the message. When you are using this way the lambda you can use Ah, let's see multiple ways to call it. And the most kind of important way is the following. Why does it not let me go to the new line? Cool. So L M B the bath core. Let's save it and the Ruby lump brooks. So it says that the B is missing. So if I run it again, it says that wrong number off arguments given the one expected. So let's call it with the message. Ruby Lum bus. Cool. And this is what I meant by strict about arguments. So if you give it too few or too many, it is going to give you a nice exception. And let's give you the put. So lahm that's cool puts. And now if we want, we can define another way. Islam. The function. So another lump the which is like this message. This is another Lunda. Call him message, and now we can call this another Lum. Another Lum. Let's save it and execute. I am So what do we have here? As you can see, we are missing the puts. Now let's define a broke statement. So, as I said, Brooks are more relaxed than Lembas. So let's say our Brooks is equal to Braatz New Block message. This is the broth message puts Brooks. If we save it and run it, you can see that this also needs to be called Let's save it and the run it once again, this didn't throw an exception because of missing arguments. But the minute I specify on argument, it is going to be passed to the broke statement. Cool. That is also another way to define Brooks, which is a shorthand short. Brooke, it's broke message. This is the short broke message message. And now if he puts the short Brooke go short message, we will see the following. And, uh, technically, this is Ah, almost all I wanted to show you. That is an extra content, which means that we could specify hello function with the block and this bloke is going to be about a message before. So this is before the block and the block that go and puts This is after the look And and now we could say that Ah, hello. This is the message put. Let's save it and execute it. So the this was kind off. All I wanted to show you about Linda's and Proxy 10. Fiber small: Why come back in this video? I'm going to talk to you about fibers. So what are fibers? Fibers are technically lower level threat interface, which means that the develop bad has more fine graded going through over the execution execution. Let me show you what I mean by this. So in order to use fibers, we need to require fiber and, ah, let's create the fiber we created by the fiber that new and we would like to do on Ah, Uh huh. About a year. But I and we say that next equals two fiber that yield I plus ECU osce one next e bless equals one, and we will end this execution. We say that our a is a quart of fiber resume on and we put the A and then be is going to be a quart fiber that resume a plus two. And we were put the B that's executed and then inspect what happens. So what school? So next is ah, reserved keyword. That's why it was not working. But ah, the output is two and five. What happened here? So, technically what we did, we created this fiber and we gave it the argument off one. And after that, what happened here is that it yielded the value plus one. So that was too. And then the fiber was also called with the resume. And then it was at the value three and now three plus one is four and four plus one is five and things we give it to so three plus one equals five. That's why we see five and then, ah, that waas Technically or so This is a way to interact with the fiber construct in her Be. What you could also do is to define another fiber, which is fiber. You do hi. And we say that next equals fiber yield I Plus it costs one next plus equals one and we will in capsule it this another fibre. So start fib equals fiber. You do? Let's close this one and we were say that starting with one. Then we will create the next worry able that is fib that transfer. And this is going to be one. Then Phoebe that transferred next war and we call this another fib. This also another fip And if you want to use it, we say that a equals start five resume puts a than a equals start. Five transfer. Hey, puts a and a peak was start fiber transferred a puts. And, uh, let's see how this looks like. So we would also like to puts the a value. No, If we run it, you can see that we are starting with one. We are transferring the value, then giving it back, then transferring it once again. So this is passing the values between the threads, so to speak. And there are important statements for the fiber, at least for the function calls. So you have the fiber good and which is yielding the couldn't Faber We have the fiber that yield which is yielding the control context which called that to resume. And we have the fiber that alive this tests to see if the fiber is alive. We have the fiber that resume which is actually starting the fiber. And we have the fiber transfer and these transfers from the current fiber to the receiving fiber and thats technical it. So I I understand that this might be a little bit confusing, but we practice you will be able to, let's see, harness the power off fibers. Thank you. For what 11. Threads small: we'll come back in this video, We're going to talk about Threading and Ruby. So what I would like to do is to show you Ah, pretty neat. Ah, demo And then explain to you how and why it works. So what we would like to do is to create an even threat and say that this is a thread that new and we would like to do the following we will have a NY equals zero and, um, we will have a vile loop with the true value. So it is going to be an infinite loop and ah, that's for the consistencies sake created with the loop to construct. And what we would like to do is say, if I even question Mark, then we would like to put hi and and ah, anyway, we would like to increase the value off the I very able with one. Let's create an old thread and thread new do and you will have the I Yeah, that's Kohli Jay, and we will have the loop do if instead of Fif, unless j even puts hashed uh, Breck J and let's replace it out. That, too. And we were just simply and this one this one and this one and also in the slope. We would like toa increment value off Jay and we will have Let's a, uh let's and we will have a main control loop. So why time is less than 10 Do and what are we going to do? Starting main thread And we will say that even thread not run ord thread that's run and sleep is one. And then time blast sick waas one and and just for the causes stance say let's give it this value Now, Uh, we would also like to make sure that our threats or whatever is executed in our fed is visible. So we were called the threat Stop thread stop. And if everything goes well, we should be able tow run this demonstration. But now we could not undefined very it, Paul. Oh boy. So we have puts, puts on and puts So look out. And if I look are very ever much che for main object, I want to have so starting may tread Exception J. Come on. Oh boy yet no. Now you must thrown cool 50. So basically what happens here is that three threads are alternating with the execution. And ah, maybe I should Ah, bring this puts out to the main part so puts starting main threat and we will just simply the seconds elapsed and we were print the time. So let's give it back one second, two seconds, three seconds, four second and so on. What happens here is the following. It's going to rain. So we have one threat which is printing out even numbers. We have another threat which is printing out numbers, and this is the main control loop. So when we this is basically running for 10 seconds, this is what this y look achieves. And at the beginning of this y loop, we are going to start our threats, execution, both of them, and they are going to start their infinite loop. And in this infinite low, based on the value it is going toe, either print uneven order, not number from different threat. So ah, let's ah, call it would thread and let's call it even thread and ah, when the threats started to run, they perform a whole group. Then at the end of the loop, they are going to stop the execution and then we will sleep for second increased the time very able. And then the starts get to run once again. And this is technically what this achieves. And ah, I like this demo because it kind of gives you an idea as to how you can interact between threads At least a way to do that. And ah, technically Ah, this Ah Waas Almost all I wanted to show you Let me bring back my Kanzler So our threat has executed successfully and I would like to thank you for watching. 12. Gemming small: welcome. In this video, we're going to talk about Ruby Gems, so gems are a way to extend the functionality off your ruby environment. So what you can do with gems is that you create solutions to specific problems, which the solutions themselves become distributable. So these are going to be small. Let's say packages, and we're going to see how and, uh, how we can go about it and what is needed to do that. So in order to create ah, a jam, what we need to do is tow create. Ah, let's say what? How do I go about it? Let's let's create a folder which is going to be caught project. And this project folder is going to hold Ah, binary project Binary folder, a dock folder, a leap folder and a test for that. So tree not and as you can see Ah, basically, this is ah, basic structure for Jim Mathematical, one of the higher. All right, and ah, inside here. The binary were contained. The execute herbal parts Doc were contained. The documentation and the league should contain what? Ah, the what? Let's see. The implantation of the function of it is so Let's see you have Ah, my your that you call, for example. How do we call it? That's call it test Here. We need to define a test that r b and inside the test. For that we need to define our classes. So class our module. So class more. You're that R b and let me go. One of the higher tree project and their ego. So after this Waas defined, you will have Ah, that's a stun dart. Ruby, uh, directory. How do I put this? And ah, let's see what? Ah are the gem ng that txt. So here I'm going to give you some notes as to how you can go about when you would like to search for a jam. All you need to do is issued jam Search bash are name off. Gem. This was search for the gem, the gem install that is not needed. Name of Jim. This will install the jam in tow into the one of the past parts that are available for Ruby for loading gems. The gem on the install name of Jim is going toe Honest are the specific gem. And you have ah, Jem file the gem file is important when you would like to distribute your gems with or projects with specific gems that are, let's say, dependencies and inside the gem five. You would say that the name off the gem and the version off the gem is following that is acting as a definite Nancy. So name, too Version Jim Name three version. And ah, that's ah kind of fit. What you can also do is to install Bandler, and this bundler is able to let the blunder your gem base on the gems back specifications. So if you use the gem in stop bond that bundle After that you could say that bomb the in stop Jim five and it would take care off installing the gems with specific version. If you do not specify a version, it will install the latest or highest available version off the specific jam. What you could also do IHS toe issue the gem server common the Jam server Common is very interesting because it allows you to de facto share your gems with your let's say friends. So jams and uh all right, it is running left me grab the browser. So hat it http local host 80 08 And this is going to give you a nice gem set summary off the machine that it is running from And what you could also dough after this is to install the gem from http full. We will stop it and say the gym install does the source http name called him 80 8808 And basically, this was all I wanted to tell you about Jim. You can always visit the documentation if you get stuck. Thank you for 13. Modules small: why come back in the city? Or we are going to talk about modules in Ruby Someone you was basically a way to provide. Ah names is named space separation. And with this name space, that separation ah, comes very interesting. That's the feature. So you could package problem definition inside small modules, and they allow you to have your own classman towards attributes, Constanze instance, my thoughts and so on. So let's create a demonstration. What you can do is to special use them on your keyboard and say the test more. You're yes, I distress my your We are going toe specify a constant, which is called one or let's make it to love him. You could also Nast, the more you're so test your column column in that what you're And this can also have a constant with the same name and the same value. Let's make it a different value. So when we print it, we are going toe not going to get confused by that, And if you want, we can do also the following. So we have a class which is called death Class, and inside this test class we will have a constant function definition and we will include the best. Well, you and this task manure is Ah, let's say going toe hold that constant that we have. So in order to refer to that constant, we only need toe say cost. And and And now when we creator this glass, the new we can't simply put the A that const Let's save it. And there will be module that are RB. So it says that it has no matador because we do not want to explicitly refer to that constant, but rather the function on and const No, we can see that it was 11. So, uh, we could also do the following here. So let's say we have Ah, uh, let's put it in a separate file. So let me just have this year and say that we will have the whim test more you that r b And in this test manure, we say that we require the model that lives in the exact same folder which is called Mario . And from now on, what we could do is the following. Let me just take a look at this. So we have the test manure cost, which is 11 and we would like toe puts the death more. Your colon colon cost equals two best more your const. Now, if you're on the test Maduro, you can see that it successfully got the value from there. What we also have here is the inner more. You're off the test manure. So let's edit our test menu puts test more Your calling column in our model calling Conan const. And this is equal to hashtag. Best more. You calling Cullen in their mature Colin. Colin Const, Let's go this and give it a test run. Yeah, Did you mean yes, Simon, This what? Uh ah ha! Missing a key. Good. So we were able to refer to that What you will and Ah, What we can also do is to try and invoke an instance of that specific class. So we say that Ah, we want to improve the test class from the more your and, uh, what do we do here? Let's create in the module. So let's call it ma your classman your and and we say that here we have the class test glass and and we would like toa refer Death ghost and we will have the class very able. So costs class 40 able 99. And we would just simply return the cost. And now, if you go back to the previous script, we have the class manure and we can do this. A equals plus more your calling cologne test class that new if you save it and run this, we do not see any exception. And now we should be about the puts cost from class inside. Uh, more. You're called him and a that const. If we run it, you can see that were successfully reached that specific. Where you inside the module off inside the class off a module. So I hope this give you an idea as to what and how you can do with modules. And there's always it takes practice and time. Thank you. For what? 14. Classes small: we'll come back in this video. We are going to talk about classes in Ruby. So let's get to it. Classes that are being so when you're working with classes you need to make sure you are family are with the following terms. Ruby, you have class our tributes which are denoted with the at that sign, you also have instance attributes which are denoted by the at sign. You also have scopes, and these are private, public and protected. So that's Ah, create a demo class. So this class is called language. This has on initialize function and it is going to take a name and the version. Now we would like to have the name equal to the argument that was passed and the version also equal to the argument that was passed. And we would also like to have ah Children mattered. Seth, that Children and this is going to be a classmethod. When we call this class mattered. It is going to return the Children off this class, and this Children is going to be nothing other than the number off instances or this class . So Children equals zero. And every time in initialized this instance we would like to increase the Children we'd won . And, ah, if free, close this class definition and create an instance called language that new it will be with the version 2.5 point five, we can put on the console the class itself so you can see that this is a class identify air we would like to also put on the court was or the name off the class. And this is not going to work because we need to define attributes, access or so 80 odd access sort. And we will have this the name diversion and, uh and and and technically that's it. Now, if we rerun this one, we can see that the ruby was printed on the output. Now what? We can do it simply say that we would like to have diversion also so right and run very well. We would also like to see the language that cheered run. And if we run this, you can see that this language class has only one Children. At the moment, let's create another Children, so be equal language. But you by thumb 3.8 and C equals language. But new go some point them. And ah, we can also brains the B that name the B, that version and we have the spare line print. See the name. See that version and another spare line. If you run this once again, what we will see is the following. We now have three instances off our specific class. Another important thing that you need to be aware off is that that is ah, way to inherit in ruby from base classes or super classes. And ah, you could say that. Ah, you want to have this glass base language and this based language is going to have ah method which is called deploy. And we were just simply say that language Waas deployed. And And if you want the language to inherit from the base language, this is all that we would have to do. And now Mm. We see that syntax settled. Why is it Oh, I have forgotten to goes my class. So now we have this based language, um, bears language. So it is important that you type the names correctly. Now what we can do is to say that we would like the court, the A, that deploy and If we run it, you can see that this method, for instance, metal was inherited from the base language. And ah, technically this is Ah, this is kind off. All I wanted to that one straight here. What you can also do is to create ah, special method which is called equals So death Equus. And we see I don't And ah, what we would also like. The doom is to say that close equals or not, I think I might do another radio about this. So technically this Waas Ah, kind off. No, no. Okay, let's implement it. So let's say we would like to have this implemented so others. And and I say that if the mm name is equal to other that name, this is what we would like Toa return, so to speak. So if I run it, what I can do is to say that the is a quarto language back new and Ruby 2.5 point four now . Ah, what I can do is to check to see if those two are equal. So if hey, you see quarto me, we would like to puts the to languages, have the same name and save it and run it. And it doesn't seem to work this way. So why is that hidden? So we have the other and d other dot Name is fightem. So a and the should be compact. And as you can see, the two languages are the same. So again, it is really crucial that you basically use the right worry a Bonhams when you are working with Ruby and, uh, technically, this is all I wanted to show you. Thank you for 15. MetaProgramming small: welcome In this video, we are going to talk about mata programming in Ruby. So if you want to show the definition off matter programming, it means that these are programs that create programs of write programs. So the execution or what will be executed is not known in front or a head off the time. So let's ah, create Ah, demonstration off chef program. So the chef is going to cook us something, and for every cooking or recipe, it is going to have a preparation step and the post cooking step that we would like toa implement. And we will not know what the chef will be cooking. We only know what are the steps that are performed when you are cooking. So let's create a module called Chef. In this manure, we will have this self that included. And what will happen here is that we will have this class body able, and we were just simply ought to put The chef is ready for service and we will end this definition. We will have a cook function and a scoop function. We'll take a recipe and a block that is going to be executed, so ah, at the recipe. We would like to define the in greedy ants for their recipe, and we will just simply print the name off the recipe. And we will also add the recipe recipes, the recipe and the block that was received here. So in order for this to work, we also need to define the recipes. And these recipes are going to be an instance where you able Ressie peas and this will be a conditional definition. So if it was already defined once, we were not redefining again and we would have a before that is going to be executed before the recipe, and it will also receive a block. And, uh, we will say that performing pre cooking steps four a recipe on and a recipe. Now we will have the before. Fear that, and this will have the the recipe and the block itself that was received. And we will have an after the recipe with the block, and we will put the performing post cooking steps for recipe recipe and after I fear that is going to have the recipe and the block. So this is going to build up a dictionary off recipes and Ah, we would also have this death before. Fear that and at before, feel that conditioner initialization death off third field, third after fear. Third conditional dictionary and and the what s we may want to do is the following. So run this run will take a recipe. And what we will do is to check if the recipe is has the key recipe. If has, then what we will do is called each block that was passed. So the before fear ther's recipe. Cool. We were called the recipes recipe cool and the after filters recipe that core. Otherwise we would like toe raise an exception, stunned art a road that new And we say that, uh, the recipe is unknown. Let's close this close that and close the rest of it. What we would like to do is to include the chef at the end of this. So now if everything goes well, we should be able toe. Let's say, execute with the ruby the matter programming that are we. And it says that undefined. Look, a very able Seth. I think itself cool. Now the chef is ready for your service. How do we put this chef to work. What we need to do is to define our let's say esto would aren't that are be and we will require the the backslash backslash matter programming that are be or without RB so right, quit and we just simply want toe execute the restaurant. Cool. Now how do we call this? So if you say that we would like to cook a chicken soup, this is what is going to happen. So we are defining the ingredients for the recipe chicken soup. We can also say that we would like toa Cook Chikane soup and we will do the following boots , cleaning equipment or pre ah, ring toe cook chicken So and we will and this thesis kind off block and before the chicken soup, we would like to do some slicing on preparation and after the chicken soup, we would like to do some cleaning and serving, and if we save it and execute it, we will see the following. So the chef is ready for your service and we define ingredients for the recipe. We are performing pre cooking steps and post cooking steps for the recipe. Now what we can do is to execute this whole at the ones so puts the hold as one. And we were created separator, and we just simply say the trump chicken soup. Oh, yeah, So we don't have the appropriate definition. Let me correct. So before filter after few. Third before fear. Third after fear. Cool. Now Ruby restaurant, Ruby restaurant. Cool on defined matter drum corn. So when and we have this and book and look after filter before fear Third and that scared to try so in the matter programming on the 34 first line Seth number. We do not have this in the before. Fear to realize that. So we have this recipe and we would like to run in this recipe on and but we have assigned this block. So now the question is, what are we missing on the 20 s line? So restaurant set number Iran Chickens. Joe. So chicken soup, Chicken soup. Poor Did sense to have it. The whole chicken soup. Now it seems that I had this typo here. Cool. So some slicing and preparation preparing to cook chicken soup and some cleaning and serving. And technically, this should give you ah, pretty good idea off the whole matter programming paradigm. There are many more ways to apply this methodology, but, ah, it takes time and practice to be aware of how and when you can use it. 16. Extras small: welcome in this video. I'm going to close my ruby session. I hope this has been informative for you. And you got what you were looking for, or at least most of them. So I want to show you some interesting stuff or so more interesting stuff that you can do with this programming language. So let's get to the extra sport. Let's say you would like toa define the weekend, which is a broke, and this is going to take time as argument and it will simply say that it's, ah time that Saturday they question mark or time, that son of a question mark the week day is going to come from the block time and time that w day less than six. Now we can inspect the time that now and when it is we come, we just simply say that put, this is so much fun when week they then we put this is not so much fun. And we closed this. Now if we save it and you'll be ex ah, trust executed, you will see that this is so much fun. And what it does is that it is going toe check to see if whether the weekend or the weekday is true in this case statement and this is what is happening here, basically there are other things that you can do you can force, say, execute extent, our comments. So let's say we want to get the date and we can use the back picks and the time for a slash d. So now if we want, we can use the puts to say This is the time now date, Let's save it and runny. So currently it's Ah five, 01 pm And there is another way to execute XML commands. And let's say that we see how this goes. Time forward slash t puts. This is also the time now, Andi it cool. Mm. Now the difference between the two. So the system and the back ticks is that if the common that you execute with system fails, it is going to return. Neil. So on fail a course, Neil. One success hick was true. And, uh, you could also use ah specific or special keyword ruby. So if you say that, begin brackets boots, this well be executed before the brooks and and puts this will be executed last now, if you run it, you can see that the sea will be executed before the Brooks and this will be executed last . So this statement can be used toe. Let's give some kind off mandatory order for your scripts. Execution? What? You could also do. Ihsaa defined. Ah, special form off strings. So let's say you want toe define a message and this message Well, look like this. So us this if, uh, more the line string and we will just simply say our us And now we can bring what puts the message. Now if he executed what is happening? E o f us, huh? Unexpected. Who Them All right then It seems to be working on the in the interactive rubbish l So that's or for