Flow of Execution (optional)
Learn how and in what flow Ruby runs your code.
Feel free to skip this chapter if you feel you understand the flow of how Ruby goes through a program, defines a method, then calls it, returns from it, maybe calls another method and so on. We’ve discussed this before. But since this is a confusing topic to some, we’ll also go over it again.
One of the things that we, as programmers, have assimilated so much that we forget to explain to beginners is how, and in what exact order, Ruby goes through your program. This is called the “flow of execution”, or “control flow”.
When you execute a Ruby file with the ruby
runtime then it will read your
Ruby code and start executing it line by line, from top to bottom. ...
Create a free account to access the full course.
By signing up, you agree to Educative's Terms of Service and Privacy Policy