Packt
Intermediate Ruby Programming and Control Structures

通过 Coursera Plus 获取 10,000 多门课程的 Accessibility

Packt

Intermediate Ruby Programming and Control Structures

本课程是 Learn to Code with Ruby 专项课程 的一部分

包含在 Coursera Plus

深入了解一个主题并学习基础知识。
中级 等级

推荐体验

1 周 完成
在 10 小时 一周
灵活的计划
自行安排学习进度
深入了解一个主题并学习基础知识。
中级 等级

推荐体验

1 周 完成
在 10 小时 一周
灵活的计划
自行安排学习进度

您将学到什么

  • 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.

要了解的详细信息

可分享的证书

添加到您的领英档案

作业

6 项作业

授课语言:英语(English)

了解顶级公司的员工如何掌握热门技能

Petrobras, TATA, Danone, Capgemini, P&G 和 L'Oreal 的徽标

积累特定领域的专业知识

本课程是 Learn to Code with Ruby 专项课程 专项课程的一部分
在注册此课程时,您还会同时注册此专项课程。
  • 向行业专家学习新概念
  • 获得对主题或工具的基础理解
  • 通过实践项目培养工作相关技能
  • 获得可共享的职业证书

该课程共有10个模块

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.

涵盖的内容

14个视频2篇阅读材料

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.

涵盖的内容

9个视频

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.

涵盖的内容

4个视频1个作业

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.

涵盖的内容

17个视频

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.

涵盖的内容

8个视频

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.

涵盖的内容

16个视频1个作业

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.

涵盖的内容

7个视频

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.

涵盖的内容

4个视频1个作业

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.

涵盖的内容

15个视频

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.

涵盖的内容

12个视频1篇阅读材料3个作业

获得职业证书

将此证书添加到您的 LinkedIn 个人资料、简历或履历中。在社交媒体和绩效考核中分享。

位教师

Packt - Course Instructors
Packt
1,186 门课程292,430 名学生

提供方

Packt

从 Software Development 浏览更多内容

人们为什么选择 Coursera 来帮助自己实现职业发展

Felipe M.
自 2018开始学习的学生
''能够按照自己的速度和节奏学习课程是一次很棒的经历。只要符合自己的时间表和心情,我就可以学习。'
Jennifer J.
自 2020开始学习的学生
''我直接将从课程中学到的概念和技能应用到一个令人兴奋的新工作项目中。'
Larry W.
自 2021开始学习的学生
''如果我的大学不提供我需要的主题课程,Coursera 便是最好的去处之一。'
Chaitanya A.
''学习不仅仅是在工作中做的更好:它远不止于此。Coursera 让我无限制地学习。'
Coursera Plus

通过 Coursera Plus 开启新生涯

无限制访问 10,000+ 世界一流的课程、实践项目和就业就绪证书课程 - 所有这些都包含在您的订阅中

通过在线学位推动您的职业生涯

获取世界一流大学的学位 - 100% 在线

加入超过 3400 家选择 Coursera for Business 的全球公司

提升员工的技能,使其在数字经济中脱颖而出

常见问题