Packt
Intermediate Ruby Programming and Control Structures

Limited time only! Get Coursera Plus for 30% off.

Reset. Reinvent. Reach new career goals. Claim your offer now.

Packt

Intermediate Ruby Programming and Control Structures

This course is part of Learn to Code with Ruby Specialization

Taught in English

Packt

Instructor: Packt

Included with Coursera Plus

Course

Gain insight into a topic and learn the fundamentals

Intermediate level

Recommended experience

13 hours (approximately)
Flexible schedule
Learn at your own pace

What you'll learn

  • Identify the differences between single and double quotes in Ruby strings.

  • Explore the various loop and control structures in Ruby.

  • Utilize debugging tools to identify and fix code issues in Ruby programs.

  • Differentiate and select appropriate array methods for handling ranges in Ruby.

Details to know

Shareable certificate

Add to your LinkedIn profile

Recently updated!

September 2024

Assessments

5 assignments

Course

Gain insight into a topic and learn the fundamentals

Intermediate level

Recommended experience

13 hours (approximately)
Flexible schedule
Learn at your own pace

See how employees at top companies are mastering in-demand skills

Placeholder

Build your subject-matter expertise

This course is part of the Learn to Code with Ruby Specialization
When you enroll in this course, you'll also be enrolled in this Specialization.
  • Learn new concepts from industry experts
  • Gain a foundational understanding of a subject or tool
  • Develop job-relevant skills with hands-on projects
  • Earn a shareable career certificate
Placeholder
Placeholder

Earn a career certificate

Add this credential to your LinkedIn profile, resume, or CV

Share it on social media and in your performance review

Placeholder

There are 10 modules in this course

In this module, we will delve into the intricacies of handling strings in Ruby. You will learn the differences between single and double quotes, how to create multiline strings with here documents, and perform string comparisons using equality and inequality operators. We'll explore different methods for concatenation, understand indexing to access and modify string characters, and apply various string methods like 'length', 'empty'?, 'capitalize', 'reverse', and bang methods for mutating strings directly. By the end of this module, you'll have a comprehensive understanding of string operations in Ruby.

What's included

14 videos2 readings

In this module, we will explore various looping constructs in Ruby. You will learn the syntax and usage of the 'while' and 'until' loops, understanding how they execute based on conditional statements. We will tackle the FizzBuzz problem, a popular beginner coding challenge, and walk through its solution. Additionally, we will introduce control flow keywords such as 'next' and 'break', and delve into recursion, where methods call themselves to solve problems. By the end of this module, you will be adept at using loops and recursion to manage repetitive tasks and complex problem-solving in Ruby.

What's included

9 videos

In this module, we will focus on debugging techniques in Ruby. You will learn to import and use the debug library to establish breakpoints with 'debugger' or 'binding.break', allowing you to pause execution and examine the program's state. We will cover the 'step' keyword to progress through code line by line and demonstrate how to use the 'info' keyword to list all variables and parameters. By combining these techniques, you will gain a thorough understanding of how to troubleshoot and resolve issues in your Ruby programs effectively.

What's included

4 videos1 assignment

In this module, we will introduce you to arrays, a fundamental data structure in Ruby for storing ordered elements. You will learn how to create arrays, including nested arrays for multidimensional data structures. We'll cover different ways to access and overwrite array elements using square bracket syntax, the 'fetch' method, and methods like 'first', 'last', and 'values_at'. You'll also explore methods to evaluate array properties such as 'length', 'size', and 'empty'?, and compare arrays using equality, inequality, and the spaceship operator. Additionally, we'll dive into methods for adding and removing elements like 'push', 'pop', 'shift', 'unshift', and 'insert'. By the end, you'll have a comprehensive understanding of array creation, access, and manipulation in Ruby.

What's included

17 videos

In this module, we will explore ranges in Ruby, an object that represents a sequence of numbers or letters. You'll learn to create numeric and alphabetical ranges and understand the rules of inclusivity and exclusivity using two and three dots. We will cover methods like 'include'? and 'member'? to check if a value exists within a range, and use the 'rand' method to generate random numbers. Additionally, you'll see how to extract sequences from strings or arrays using ranges, and incorporate ranges into case statements for efficient logic handling. Finally, we'll convert ranges to arrays using the 'to_a' method, giving you versatile tools for working with sequential data in Ruby.

What's included

8 videos

In this module, we will dive deeper into array operations, focusing on iteration and advanced methods. You will learn to use the 'each' and 'each_with_index' methods for sequential element traversal, and how to nest 'each' method calls for more complex operations. We'll explore using traditional 'for' loops and alternatives like 'while' and 'until' loops for array iteration. Methods such as 'map', 'collect', 'select', 'reject', and 'partition' will be introduced to transform and filter arrays based on conditions. You will also learn to query arrays with methods like 'any?', 'all?', 'find', 'detect', 'index', 'include?', 'max', and 'min', and understand how to handle unlimited method arguments using the splat operator. By the end of this module, you'll have a comprehensive toolkit for effectively managing and manipulating arrays in Ruby.

What's included

16 videos1 assignment

In this module, we will continue exploring advanced string manipulation techniques in Ruby. You will learn to use the 'split' method to divide strings into arrays based on specified delimiters and the 'join' method to merge array elements back into a single string. We will cover iterating over string characters with the 'chars' and 'each_char' methods, and converting strings to arrays for iteration. Additionally, you'll learn to count occurrences of substrings with the 'count' method, find positions of substrings using 'index' and 'rindex', and remove characters from strings with the 'delete' method. By the end of this module, you'll have a robust set of tools for handling and manipulating strings in your Ruby programs.

What's included

7 videos

In this module, we will explore how object references and copies work in Ruby. We will then cover the 'dup' and 'clone' methods, which create copies of objects, isolating them from changes made to the source object. The 'freeze' method will be introduced to make objects immutable, ensuring their state cannot be altered. Additionally, we'll discuss how passing objects to methods can lead to mutations and how to manage these changes effectively. By the end of this module, you will have a solid understanding of object references, copying, and immutability in Ruby.

What's included

4 videos1 assignment

In this module, we will introduce you to hashes, a versatile data structure for associating keys with values. You will learn how to create and manipulate hashes using various syntaxes, including hash rockets and shorthand notations with symbols as keys. We will cover methods for adding, iterating over, and checking the inclusion of key-value pairs, as well as extracting subsets, converting between hashes and arrays, and removing pairs. Additionally, you will explore advanced operations like merging hashes and creating hashes with default values, while addressing potential reference issues. By the end, you'll be proficient in creating, managing, and manipulating hashes in Ruby.

What's included

15 videos

In this module, we will explore advanced array methods that provide powerful ways to manipulate and transform arrays in Ruby. You'll learn to reverse and sort arrays, remove duplicates with 'uniq', and eliminate 'nil' values using 'compact'. We will cover aggregation methods like 'inject' and 'reduce', as well as methods to flatten nested arrays. Additionally, you'll learn to extract random elements with 'sample', repeat elements using the asterisk operator, merge arrays while excluding duplicates, subtract elements, and find intersections between arrays with the '&' operator. By the end, you'll be adept at using these advanced methods to handle and manipulate arrays efficiently in your Ruby programs.

What's included

12 videos1 reading2 assignments

Instructor

Packt
Packt
38 Courses736 learners

Offered by

Packt

Recommended if you're interested in Software Development

Why people choose Coursera for their career

Felipe M.
Learner since 2018
"To be able to take courses at my own pace and rhythm has been an amazing experience. I can learn whenever it fits my schedule and mood."
Jennifer J.
Learner since 2020
"I directly applied the concepts and skills I learned from my courses to an exciting new project at work."
Larry W.
Learner since 2021
"When I need courses on topics that my university doesn't offer, Coursera is one of the best places to go."
Chaitanya A.
"Learning isn't just about being better at your job: it's so much more than that. Coursera allows me to learn without limits."

New to Software Development? Start here.

Placeholder

Open new doors with Coursera Plus

Unlimited access to 7,000+ world-class courses, hands-on projects, and job-ready certificate programs - all included in your subscription

Advance your career with an online degree

Earn a degree from world-class universities - 100% online

Join over 3,400 global companies that choose Coursera for Business

Upskill your employees to excel in the digital economy

Frequently asked questions