chore: sync content to repo (#9539)

Co-authored-by: kamranahmedse <4921183+kamranahmedse@users.noreply.github.com>
This commit is contained in:
github-actions[bot]
2026-01-13 16:50:12 +01:00
committed by GitHub
parent e19ba12c03
commit d27425175c
34 changed files with 216 additions and 38 deletions

View File

@@ -1,3 +1,8 @@
# Arithmetic Operators
Arithmetic operators are symbols that perform mathematical calculations on numerical values. These operators allow you to perform addition, subtraction, multiplication, division, and other common arithmetic operations. They take one or more operands (the values being operated on) and produce a result based on the operation performed.
Arithmetic operators are symbols that perform mathematical calculations on numerical values. These operators allow you to perform addition, subtraction, multiplication, division, and other common arithmetic operations. They take one or more operands (the values being operated on) and produce a result based on the operation performed.
Visit the following resources to learn more:
- [@article@Arithmetical operators](https://ruby-for-beginners.rubymonstas.org/operators/arithmetical.html)
- [@article@Ruby - Operators](https://www.tutorialspoint.com/ruby/ruby_operators.htm)

View File

@@ -1,3 +1,12 @@
# Arrays
Arrays in Ruby are ordered collections of items. They can hold any type of data, including numbers, strings, symbols, or even other arrays. You create an array using square brackets `[]`, with elements separated by commas. Arrays are dynamic, meaning their size can change as you add or remove elements. You can access elements in an array using their index, starting from 0 for the first element.
Arrays in Ruby are ordered collections of items. They can hold any type of data, including numbers, strings, symbols, or even other arrays. You create an array using square brackets `[]`, with elements separated by commas. Arrays are dynamic, meaning their size can change as you add or remove elements. You can access elements in an array using their index, starting from 0 for the first element.
Visit the following resources to learn more:
- [@official@class Array](https://docs.ruby-lang.org/en/master/Array.html)
- [@article@Arrays](https://www.theodinproject.com/lessons/ruby-arrays)
- [@article@Ruby Arrays](https://www.tutorialspoint.com/ruby/ruby_arrays.htm)
- [@article@Arrrays](https://ruby-for-beginners.rubymonstas.org/built_in_classes/arrays.html)
- [@video@Arrays are Easy in Ruby for Beginners 9](https://www.youtube.com/watch?v=PeyodDIfLeE)
- [@video@Arrays | Ruby | Tutorial 13](https://www.youtube.com/watch?v=SP3Vf2KcYeU)

View File

@@ -1,3 +1,8 @@
# Assignment Operators
Assignment operators in Ruby are used to assign values to variables. The most basic assignment operator is the equals sign (=), which assigns the value on the right-hand side to the variable on the left-hand side. Ruby also provides compound assignment operators that combine assignment with arithmetic or bitwise operations, such as +=, -=, *=, /=, and %=. These operators modify the variable's value by performing the specified operation with the right-hand side operand and then assigning the result back to the variable.
Assignment operators in Ruby are used to assign values to variables. The most basic assignment operator is the equals sign (=), which assigns the value on the right-hand side to the variable on the left-hand side. Ruby also provides compound assignment operators that combine assignment with arithmetic or bitwise operations, such as +=, -=, \*=, /=, and %=. These operators modify the variable's value by performing the specified operation with the right-hand side operand and then assigning the result back to the variable.
Visit the following resources to learn more:
- [@article@Assignment operators](https://kddnewton.com/2023/07/20/ruby-operators.html#assignment-operators)
- [@article@Ruby - Operators](https://www.tutorialspoint.com/ruby/ruby_operators.htm)

View File

@@ -1,3 +1,3 @@
# Exception Handling with `begin`, `rescue`, and `ensure`
# Exception Handling with begin, rescue, and ensure
Exception handling is a mechanism to deal with errors that occur during the execution of a program. In Ruby, the `begin`, `rescue`, and `ensure` keywords provide a structured way to handle these exceptions. The `begin` block encloses the code that might raise an exception. If an exception occurs, the `rescue` block catches and handles it. The `ensure` block, if present, guarantees that its code will always be executed, regardless of whether an exception was raised or not, making it suitable for cleanup operations.

View File

@@ -1,3 +1,9 @@
# Break Statement in Ruby
The `break` statement in Ruby is a control flow tool used to exit a loop prematurely. When `break` is encountered within a loop (like `for`, `while`, `until`, or `each`), the loop's execution is immediately terminated, and the program continues with the next statement after the loop. It's useful for stopping a loop when a specific condition is met, preventing unnecessary iterations.
The `break` statement in Ruby is a control flow tool used to exit a loop prematurely. When `break` is encountered within a loop (like `for`, `while`, `until`, or `each`), the loop's execution is immediately terminated, and the program continues with the next statement after the loop. It's useful for stopping a loop when a specific condition is met, preventing unnecessary iterations.
Visit the following resources to learn more:
- [@article@Understanding The Ruby Next & Break Keywords](https://www.rubyguides.com/2019/09/ruby-next-break-keywords/)
- [@article@Controlling Loop Execution](https://launchschool.com/books/ruby/read/loops_iterators#controllloop)
- [@article@Ruby Explained: Iteration](https://eriktrautman.com/posts/ruby-explained-iteration)

View File

@@ -1,3 +1,9 @@
# Case Statements
A `case` statement in Ruby provides a way to execute different blocks of code based on the value of a variable or expression. It's an alternative to using multiple `if/elsif/else` statements, especially when you need to check for several different possible values. The `case` statement compares a given value against multiple `when` clauses, and executes the code block associated with the first matching clause. An optional `else` clause can be included to handle cases where none of the `when` clauses match.
A `case` statement in Ruby provides a way to execute different blocks of code based on the value of a variable or expression. It's an alternative to using multiple `if/elsif/else` statements, especially when you need to check for several different possible values. The `case` statement compares a given value against multiple `when` clauses, and executes the code block associated with the first matching clause. An optional `else` clause can be included to handle cases where none of the `when` clauses match.
Visit the following resources to learn more:
- [@article@Case statements](https://www.theodinproject.com/lessons/ruby-conditional-logic#case-statements)
- [@article@The Many Uses Of Ruby Case Statements](https://www.rubyguides.com/2015/10/ruby-case/)
- [@video@case..when in Ruby](https://www.youtube.com/watch?v=gsmexAC2eoM)

View File

@@ -1,3 +1,8 @@
# Comparison Operators
Comparison operators are symbols used to compare two values. These operators evaluate to either `true` or `false` based on the relationship between the values being compared. Common comparison operators include equal to (`==`), not equal to (`!=`), greater than (`>`), less than (`<`), greater than or equal to (`>=`), and less than or equal to (`<=`).
Comparison operators are symbols used to compare two values. These operators evaluate to either `true` or `false` based on the relationship between the values being compared. Common comparison operators include equal to (`==`), not equal to (`!=`), greater than (`>`), less than (`<`), greater than or equal to (`>=`), and less than or equal to (`<=`).
Visit the following resources to learn more:
- [@article@Comparison operators](https://ruby-for-beginners.rubymonstas.org/operators/comparison.html)
- [@article@Ruby - Operators](https://www.tutorialspoint.com/ruby/ruby_operators.htm)

View File

@@ -1,3 +1,9 @@
# Conditional Statements
Conditional statements allow you to execute different blocks of code based on whether a certain condition is true or false. They provide a way to control the flow of your program, enabling it to make decisions and respond differently to various inputs or situations. Common conditional statements include `if`, `elsif`, `else`, and `unless`.
Conditional statements allow you to execute different blocks of code based on whether a certain condition is true or false. They provide a way to control the flow of your program, enabling it to make decisions and respond differently to various inputs or situations. Common conditional statements include `if`, `elsif`, `else`, and `unless`.
Visit the following resources to learn more:
- [@article@Conditional Logic](https://www.theodinproject.com/lessons/ruby-conditional-logic)
- [@article@The Beginner's Guide to Ruby If & Else Statements](http://rubyguides.com/ruby-tutorial/ruby-if-else/)
- [@article@Ruby - if...else, case, unless](https://www.tutorialspoint.com/ruby/ruby_if_else.htm)

View File

@@ -1,6 +1,6 @@
# Constants & Variables
In Ruby, variables are named storage locations that hold data, and their values can be changed during the program's execution. Constants, on the other hand, are also named storage locations, but their values are intended to remain fixed throughout the program's runtime. While Ruby technically allows you to reassign a constant (it will issue a warning), the convention is to treat them as immutable values that should not be altered. Variables are typically named using snake_case, while constants are named using SCREAMING_SNAKE_CASE.
In Ruby, variables are named storage locations that hold data, and their values can be changed during the program's execution. Constants, on the other hand, are also named storage locations, but their values are intended to remain fixed throughout the program's runtime. While Ruby technically allows you to reassign a constant (it will issue a warning), the convention is to treat them as immutable values that should not be altered. Variables are typically named using snake\_case, while constants are named using SCREAMING\_SNAKE\_CASE.
Visit the following resources to learn more:

View File

@@ -1,3 +1,8 @@
# do/while Loops
`do/while` loops are a type of control flow statement that executes a block of code at least once, and then repeatedly executes the block as long as a specified condition is true. The condition is checked *after* the code block is executed, ensuring the block runs at least one time regardless of the initial state of the condition. This is different from a `while` loop, where the condition is checked *before* the code block is executed.
`do/while` loops are a type of control flow statement that executes a block of code at least once, and then repeatedly executes the block as long as a specified condition is true. The condition is checked _after_ the code block is executed, ensuring the block runs at least one time regardless of the initial state of the condition. This is different from a `while` loop, where the condition is checked _before_ the code block is executed.
Visit the following resources to learn more:
- [@article@Ruby Loops](https://www.codecademy.com/resources/docs/ruby/loops)
- [@video@Ruby For Beginners #5 - Loops | For, While, Do, Do While](https://www.youtube.com/watch?v=Q_zP40toAMY)

View File

@@ -1,3 +1,9 @@
# Each
`each` is a fundamental method in Ruby used to iterate over elements within a collection, such as an array or a hash. It applies a given block of code to each element in the collection, allowing you to perform operations on every item. The `each` method does not modify the original collection; it simply iterates through it.
`each` is a fundamental method in Ruby used to iterate over elements within a collection, such as an array or a hash. It applies a given block of code to each element in the collection, allowing you to perform operations on every item. The `each` method does not modify the original collection; it simply iterates through it.
Visit the following resources to learn more:
- [@official@Iterators](https://www.ruby-lang.org/en/documentation/faq/5/)
- [@article@Iterators](https://launchschool.com/books/ruby/read/loops_iterators#iterators)
- [@article@Ruby Explained: Iteration](https://eriktrautman.com/posts/ruby-explained-iteration)

View File

@@ -1,3 +1,11 @@
# Enumerable
Enumerable is a module in Ruby that provides a collection of useful iteration methods. It's designed to be mixed into classes that represent collections of data, such as arrays and hashes. By including Enumerable, a class gains the ability to iterate over its elements and perform operations like searching, filtering, sorting, and transforming data in a concise and readable way.
Enumerable is a module in Ruby that provides a collection of useful iteration methods. It's designed to be mixed into classes that represent collections of data, such as arrays and hashes. By including Enumerable, a class gains the ability to iterate over its elements and perform operations like searching, filtering, sorting, and transforming data in a concise and readable way.
Visit the following resources to learn more:
- [@official@module Enumerable](https://ruby-doc.org/3.4.1/Enumerable.html)
- [@article@Basic Enumerable Methods](https://www.theodinproject.com/lessons/ruby-basic-enumerable-methods)
- [@article@Enumerable](https://rubyreferences.github.io/rubyref/builtin/types/enumerable.html)
- [@article@An Introduction to Ruby Enumerators and the Enumerable Module](https://betterstack.com/community/guides/scaling-ruby/enumerators-enumerable/)
- [@video@How to use Enumerable with Ruby Classes](https://www.youtube.com/watch?v=zALFRuKZQYc)

View File

@@ -1,3 +1,9 @@
# Fetching
`Enumerable` comes with some methods that allow you to retrieve elements from a collection based on specific criteria or conditions. This often involves iterating through the collection and selecting elements that meet a certain requirement, or accessing elements at specific indices. Methods like `find`, `select`, `detect`, and array-like indexing are commonly used to fetch elements from an `Enumerable` object.
`Enumerable` comes with some methods that allow you to retrieve entries from the Enumerable, without modifying it. This includes methods to get leading and trailing elements, extract minimum and maximum value elements, as well as conduct groups, slices, and partitions.
Visit the following resources to learn more:
- [@article@https://ruby-doc.org/3.4.1/Enumerable.html#top](https://ruby-doc.org/3.4.1/Enumerable.html#top)
- [@article@Getting to know Ruby's Enumerable Module](https://www.rafaelmontas.com/getting-to-know-ruby-enumerable-module/)
- [@article@The Simple Yet Powerful Ruby Enumerable Module](https://www.cloudbees.com/blog/the-enumerable-module)

View File

@@ -1,3 +1,9 @@
# For Loop
The `for` loop in Ruby provides a way to iterate over a sequence of values, such as elements in an array or a range. It executes a block of code for each item in the sequence. While functional, the `for` loop is not as commonly used in Ruby as other iteration methods like `each`, `map`, or `select`, which are often considered more idiomatic and flexible.
The `for` loop in Ruby provides a way to iterate over a sequence of values, such as elements in an array or a range. It executes a block of code for each item in the sequence. While functional, the `for` loop is not as commonly used in Ruby as other iteration methods like `each`, `map`, or `select`, which are often considered more idiomatic and flexible.
Visit the following resources to learn more:
- [@article@For Loops](https://launchschool.com/books/ruby/read/loops_iterators#forloops)
- [@article@For loop](https://www.theodinproject.com/lessons/ruby-loops#for-loop)
- [@video@Ruby For Beginners #5 - Loops | For, While, Do, Do While](https://www.youtube.com/watch?v=Q_zP40toAMY)

View File

@@ -1,3 +1,11 @@
# Ruby Hashes
Hashes are collections of key-value pairs. Think of them like dictionaries, where each word (the key) has a definition (the value). Keys are unique within a hash, and they are used to quickly access their corresponding values. Hashes can store any type of data as keys and values, making them a versatile way to organize and retrieve information.
Hashes are collections of key-value pairs. Think of them like dictionaries, where each word (the key) has a definition (the value). Keys are unique within a hash, and they are used to quickly access their corresponding values. Hashes can store any type of data as keys and values, making them a versatile way to organize and retrieve information.
Visit the following resources to learn more:
- [@official@Ruby - Hashes](https://www.tutorialspoint.com/ruby/ruby_hashes.htm)
- [@article@Hashes](https://www.theodinproject.com/lessons/ruby-hashes)
- [@article@class Hash](https://docs.ruby-lang.org/en/master/Hash.html)
- [@video@Hashes | Ruby | Tutorial 14](https://www.youtube.com/watch?v=BtHKhsDUPwQ)
- [@video@Ruby Programming Tutorial - 31 - Hashes](https://www.youtube.com/watch?v=imns9_XncQU)

View File

@@ -1,3 +1,10 @@
# Conditional Statements (if, elsif, else)
Conditional statements allow you to execute different blocks of code based on whether a certain condition is true or false. The `if` statement executes a block of code if a condition is true. The `elsif` statement (optional) allows you to check additional conditions if the initial `if` condition is false. The `else` statement (optional) provides a block of code to execute if none of the preceding conditions are true.
Conditional statements allow you to execute different blocks of code based on whether a certain condition is true or false. The `if` statement executes a block of code if a condition is true. The `elsif` statement (optional) allows you to check additional conditions if the initial `if` condition is false. The `else` statement (optional) provides a block of code to execute if none of the preceding conditions are true.
Visit the following resources to learn more:
- [@article@Conditionals](https://ruby-for-beginners.rubymonstas.org/conditionals.html)
- [@article@The Beginner's Guide to Ruby If & Else Statements](https://www.rubyguides.com/ruby-tutorial/ruby-if-else/)
- [@article@Conditional logic](https://www.theodinproject.com/lessons/ruby-conditional-logic)
- [@video@If Statements | Ruby | Tutorial 17](https://www.youtube.com/watch?v=Ss-IHmrSTow)

View File

@@ -5,7 +5,7 @@ Installers are software packages designed to simplify the process of setting up
Visit the following resources to learn more:
- [@official@Installers - Ruby Docs](https://www.ruby-lang.org/en/documentation/installation/#installers)
- [@opensource@ruby-build (macOS, Linux, UNIX OS)](https://github.com/rbenv/ruby-build#readme)
- [@opensource@ruby-install (macOS, Linux, UNIX OS)](https://github.com/postmodern/ruby-install#readme)
- [@official@RubyInstaller (Windows)](https://rubyinstaller.org/)
- [@official@Ruby Stack](https://bitnami.com/stack/ruby/installer)
- [@official@Ruby Stack](https://bitnami.com/stack/ruby/installer)
- [@opensource@ruby-build (macOS, Linux, UNIX OS)](https://github.com/rbenv/ruby-build#readme)
- [@opensource@ruby-install (macOS, Linux, UNIX OS)](https://github.com/postmodern/ruby-install#readme)

View File

@@ -4,12 +4,12 @@ Ruby is a dynamic, open-source programming language known for its simplicity and
Visit the following resources to learn more:
- [@book@The Ruby Programming Language](https://github.com/maniramakumar/the-best-ruby-books/blob/master/books/The%20Ruby%20Programming%20Language.pdf)
- [@official@Ruby](https://www.ruby-lang.org/en/)
- [@official@Documentation](https://www.ruby-lang.org/en/documentation/)
- [@official@Ruby in Twenty Minutes](https://www.ruby-lang.org/en/documentation/quickstart/)
- [@article@Ruby Tutorial](https://www.tutorialspoint.com/ruby/index.htm)
- [@article@Learn Ruby Online](https://www.learnrubyonline.org/)
- [@book@The Ruby Programming Language](https://github.com/maniramakumar/the-best-ruby-books/blob/master/books/The%20Ruby%20Programming%20Language.pdf)
- [@video@Ruby Programming Language - Full Course](https://www.youtube.com/playlist?list=PL_EzhIKp343lBMH4UuklrMRL_WkilGoXe)
- [@video@Masterclass | Ruby Programming in 1 video | Beginners Ruby HandsOn Crash Course Interview FAQs |](https://www.youtube.com/watch?v=xyDoP5a_dvo)
- [@feed@Explore top posts about Ruby](https://app.daily.dev/tags/ruby?ref=roadmapsh)

View File

@@ -1,3 +1,9 @@
# Iterating with Enumerable
The `Enumerable` module in Ruby provides a collection of methods that allow you to traverse and process elements within a collection (like an array or hash). These iterating methods, such as `each`, `map`, `select`, and `reject`, simplify the process of performing actions on each item in the collection, transforming the collection, or filtering elements based on specific conditions. They abstract away the need for manual indexing and provide a more concise and readable way to work with collections.
The `Enumerable` module in Ruby provides a collection of methods that allow you to traverse and process elements within a collection (like an array or hash). These iterating methods, such as `each`, `map`, `select`, and `reject`, simplify the process of performing actions on each item in the collection, transforming the collection, or filtering elements based on specific conditions. They abstract away the need for manual indexing and provide a more concise and readable way to work with collections.
Visit the following resources to learn more:
- [@article@module Enumerable](https://ruby-doc.org/3.4.1/Enumerable.html#top)
- [@article@Programación Iterating in Ruby: Enumerable and Enumerators](https://libreim.github.io/blog/2015/08/24/ruby-enumerators/)
- [@article@Understanding Ruby - Enumerable - Iterating and Taking](https://dev.to/baweaver/understanding-ruby-enumerable-iterating-and-taking-1fga)

View File

@@ -1,3 +1,8 @@
# Logical Operators
# Logical Operators in Ruby
Logical operators are symbols or keywords used to combine or modify boolean expressions (true or false). They allow you to create more complex conditions in your code. Common logical operators include AND, OR, and NOT, which are used to determine the overall truthiness of a combined expression based on the truthiness of its individual parts.
Logical operators in Ruby let you combine or modify boolean expressions (true or false). The main ones are `&&` (and), `||` (or), and `!` (not). `&&` returns true only if both operands are true. `||` returns true if at least one operand is true. `!` reverses the boolean value of its operand, turning true into false and vice versa. These operators are fundamental for controlling program flow based on different conditions.
Visit the following resources to learn more:
- [@article@Logical operators](https://ruby-for-beginners.rubymonstas.org/operators/logical.html)
- [@article@Ruby - Operators](https://www.tutorialspoint.com/ruby/ruby_operators.htm)

View File

@@ -1,3 +1,9 @@
# Next Keyword in Loops
The `next` keyword in Ruby provides a way to skip the current iteration of a loop and proceed directly to the next iteration. When `next` is encountered within a loop (like `for`, `while`, `until`, or iterators like `each`), the remaining code in the current loop cycle is bypassed, and the loop immediately begins its next cycle, if one exists. This is useful for skipping certain elements or conditions within a collection or range.
The `next` keyword in Ruby provides a way to skip the current iteration of a loop and proceed directly to the next iteration. When `next` is encountered within a loop (like `for`, `while`, `until`, or iterators like `each`), the remaining code in the current loop cycle is bypassed, and the loop immediately begins its next cycle, if one exists. This is useful for skipping certain elements or conditions within a collection or range.
Visit the following resources to learn more:
- [@article@Controlling Loop Execution](https://launchschool.com/books/ruby/read/loops_iterators#controllloop)
- [@article@Ruby Explained: Iteration](https://eriktrautman.com/posts/ruby-explained-iteration)
- [@article@Understanding The Ruby Next & Break Keywords](https://www.rubyguides.com/2019/09/ruby-next-break-keywords/)

View File

@@ -1,3 +1,10 @@
# Nil
`nil` represents the absence of a value or a non-existent object. It's a special object in Ruby that signifies emptiness or the lack of a meaningful result. Think of it as a placeholder indicating that a variable or expression doesn't currently hold a valid value.
`nil` represents the absence of a value or a non-existent object. It's a special object in Ruby that signifies emptiness or the lack of a meaningful result. Think of it as a placeholder indicating that a variable or expression doesn't currently hold a valid value.
Visit the following resources to learn more:
- [@article@Nothingness and the truth](http://ruby-for-beginners.rubymonstas.org/conditionals/nothing_and_truth.html)
- [@article@Everything You Need to Know About Nil](https://www.rubyguides.com/2018/01/ruby-nil/)
- [@article@True, False, and Nil](https://ruby-for-beginners.rubymonstas.org/built_in_classes/true_false_nil.html)
- [@video@Ruby Nil Explained](https://www.youtube.com/watch?v=mBJrQ84f6-4)

View File

@@ -1,3 +1,8 @@
# Querying
# Querying Enumerable Collections
`Enumerable` comes with some methods that allow you to search and filter elements within a collection based on specific conditions. These methods return elements that match your criteria, providing a way to extract relevant data from a larger set. This allows you to efficiently find specific items or subsets of items within a collection without manually iterating through each element.
Enumerable querying methods in Ruby allow you to gather information *about* a collection without necessarily extracting or transforming its elements. These methods check for the presence of elements that meet certain conditions, determine the size or characteristics of the collection, or verify if all or any elements satisfy a given criteria. They return boolean values, counts, or other summary data about the Enumerable itself, rather than returning a modified Enumerable.
Visit the following resources to learn more:
- [@article@Methods for Querying](https://ruby-doc.org/3.4.1/Enumerable.html#module-Enumerable-label-Methods+for+Querying)
- [@article@Getting to know Ruby's Enumerable Module](https://www.rafaelmontas.com/getting-to-know-ruby-enumerable-module/)

View File

@@ -1,3 +1,8 @@
# Ranges
Ranges in Ruby are used to create a sequence of values. They are defined using two endpoints, which can be numbers, characters, or any objects that can be compared using the `<=>` operator. Ranges can be inclusive (including the last value) or exclusive (excluding the last value), denoted by `..` and `...` respectively. They are commonly used for iterating over a sequence, creating subsets of arrays, and checking if a value falls within a specific interval.
Ranges in Ruby are used to create a sequence of values. They are defined using two endpoints, which can be numbers, characters, or any objects that can be compared using the `<=>` operator. Ranges can be inclusive (including the last value) or exclusive (excluding the last value), denoted by `..` and `...` respectively. They are commonly used for iterating over a sequence, creating subsets of arrays, and checking if a value falls within a specific interval.
Visit the following resources to learn more:
- [@article@Range operators](https://kddnewton.com/2023/07/20/ruby-operators.html#range-operators)
- [@article@Ruby - Operators](https://www.tutorialspoint.com/ruby/ruby_operators.htm)

View File

@@ -1,3 +1,9 @@
# Redo
`redo` is a control flow statement in Ruby used within loops (like `for`, `while`, `until`) and iterators (like `each`, `map`). When `redo` is encountered, it restarts the current iteration of the loop or iterator from the beginning, without evaluating any remaining code in that iteration. It essentially repeats the current step.
`redo` is a control flow statement in Ruby used within loops (like `for`, `while`, `until`) and iterators (like `each`, `map`). When `redo` is encountered, it restarts the current iteration of the loop or iterator from the beginning, without evaluating any remaining code in that iteration. It essentially repeats the current step.
Visit the following resources to learn more:
- [@article@Ruby's redo, retry and next keywords](https://blog.appsignal.com/2018/06/05/redo-retry-next.html)
- [@article@The redo Keyword in Ruby](https://medium.com/rubycademy/the-redo-keyword-in-ruby-3f150d69e3c2)
- [@video@#23 Ruby Tutorial - NEXT and REDO statements with codes in Ruby](https://www.youtube.com/watch?v=oHlSMSawyc8)

View File

@@ -1,3 +1,3 @@
# RubyGems
RubyGems is a package management system for the Ruby programming language. It provides a standard format for distributing Ruby programs and libraries (called "gems"), a tool for easily installing gems, and a central repository (RubyGems.org) for finding and sharing them. It simplifies the process of managing dependencies and distributing reusable code in the Ruby ecosystem.
RubyGems is a package management system for the Ruby programming language. It provides a standard format for distributing Ruby programs and libraries (called "gems"), a tool for easily installing gems, and a central repository ([RubyGems.org](http://RubyGems.org)) for finding and sharing them. It simplifies the process of managing dependencies and distributing reusable code in the Ruby ecosystem.

View File

@@ -1,3 +1,9 @@
# Searching and Filtering in Enumerable
`Enumerable` comes with some methods that allow you to select specific elements from a collection based on certain criteria. This allows you to extract subsets of data that meet your desired conditions, making it easier to work with large datasets or focus on relevant information. Common operations include finding the first element that satisfies a condition, selecting all elements that match a pattern, or rejecting elements that don't meet specific requirements.
`Enumerable` comes with some methods that allow you to select specific elements from a collection based on certain criteria. This allows you to extract subsets of data that meet your desired conditions, making it easier to work with large datasets or focus on relevant information. Common operations include finding the first element that satisfies a condition, selecting all elements that match a pattern, or rejecting elements that don't meet specific requirements.
Visit the following resources to learn more:
- [@article@module Enumerable](https://ruby-doc.org/3.4.1/Enumerable.html#top)
- [@article@Getting to know Ruby's Enumerable Module](https://www.rafaelmontas.com/getting-to-know-ruby-enumerable-module/)
- [@article@Understanding Ruby - Enumerable - Searching and Filtering](https://dev.to/baweaver/understanding-ruby-enumerable-searching-and-filtering-23o7)

View File

@@ -1,3 +1,9 @@
# Sorting in Enumerable
The `Enumerable` module in Ruby provides several methods for sorting collections. These methods allow you to arrange elements in ascending or descending order based on their natural ordering or a custom comparison logic. The most common sorting methods include `sort`, which returns a new sorted array, and `sort_by`, which sorts based on the result of a block applied to each element. You can also use `min`, `max`, `minmax` to find the smallest, largest, or both smallest and largest elements in a collection, respectively.
The `Enumerable` module in Ruby provides several methods for sorting collections. These methods allow you to arrange elements in ascending or descending order based on their natural ordering or a custom comparison logic. The most common sorting methods include `sort`, which returns a new sorted array, and `sort_by`, which sorts based on the result of a block applied to each element. You can also use `min`, `max`, `minmax` to find the smallest, largest, or both smallest and largest elements in a collection, respectively.
Visit the following resources to learn more:
- [@article@module Enumerable](https://ruby-doc.org/3.4.1/Enumerable.html#top)
- [@article@Understanding Ruby - Enumerable - Sorting and Comparing](https://dev.to/baweaver/understanding-ruby-enumerable-sorting-and-comparing-fff)
- [@article@Sorting short sequences with Enumerable#sort_by](https://silvercat.com/blog/sort-by-unexpected-ordering)

View File

@@ -1,3 +1,10 @@
# Symbols
Symbols are lightweight, immutable strings often used as identifiers or names within a Ruby program. Unlike regular strings, symbols are guaranteed to be unique; Ruby only creates one copy of a symbol, regardless of how many times it's referenced. This makes them efficient for tasks like hash keys or representing states, where comparing identity is more important than comparing content. They are typically written with a colon prefix, like `:my_symbol`.
Symbols are lightweight, immutable strings often used as identifiers or names within a Ruby program. Unlike regular strings, symbols are guaranteed to be unique; Ruby only creates one copy of a symbol, regardless of how many times it's referenced. This makes them efficient for tasks like hash keys or representing states, where comparing identity is more important than comparing content. They are typically written with a colon prefix, like `:my_symbol`.
Visit the following resources to learn more:
- [@official@class Symbol](https://docs.ruby-lang.org/en/master/Symbol.html)
- [@article@Symbols](https://ruby-for-beginners.rubymonstas.org/built_in_classes/symbols.html)
- [@article@What Are Ruby Symbols & How Do They Work?](https://www.rubyguides.com/2018/02/ruby-symbols/)
- [@video@Ruby's Symbols Explained](https://www.youtube.com/watch?v=mBXGBbEbXZY&t=16s&pp=ygUMc3ltbm9scyBydWJ5)

View File

@@ -1,3 +1,9 @@
# Times Loop
The `times` method in Ruby is a simple way to execute a block of code a specified number of times. It's called on an integer, and the block is executed that many times, with an optional block variable representing the current iteration number (starting from zero). It provides a concise way to repeat actions without needing to explicitly manage a counter variable.
The `times` method in Ruby is a simple way to execute a block of code a specified number of times. It's called on an integer, and the block is executed that many times, with an optional block variable representing the current iteration number (starting from zero). It provides a concise way to repeat actions without needing to explicitly manage a counter variable.
Visit the following resources to learn more:
- [@article@Times loop](https://www.theodinproject.com/lessons/ruby-loops#times-loop)
- [@article@Ruby Explained: Iteration](https://eriktrautman.com/posts/ruby-explained-iteration)
- [@video@#20 Ruby Tutorial - For Loop and its Alternative .each loop](https://www.youtube.com/watch?v=0Bp-91lv-zw)

View File

@@ -1,3 +1,9 @@
# Type Casting
Type casting, also known as type conversion, is the process of changing a value from one data type to another. This is often necessary when you need to perform operations that require specific data types or when you want to represent data in a different format. For example, you might need to convert a string representation of a number into an actual integer or float to perform mathematical calculations.
Type casting, also known as type conversion, is the process of changing a value from one data type to another. This is often necessary when you need to perform operations that require specific data types or when you want to represent data in a different format. For example, you might need to convert a string representation of a number into an actual integer or float to perform mathematical calculations.
Visit the following resources to learn more:
- [@article@Ruby type conversion](https://kddnewton.com/2021/09/09/ruby-type-conversion.html)
- [@article@How To Convert Data Types in Ruby](https://www.digitalocean.com/community/tutorials/how-to-convert-data-types-in-ruby)
- [@article@Confident Code - Ruby Implicit and Explicit Type Converters](https://whatapalaver.co.uk/ruby-implicit-explicit-type-conversion)

View File

@@ -1,3 +1,9 @@
# Unless
`unless` is a conditional statement in Ruby that executes a block of code only if a specified condition is false. It's essentially the opposite of `if`. If the condition provided to `unless` evaluates to false, the code block is executed; otherwise, the code block is skipped. It provides a more readable way to express negative conditions.
`unless` is a conditional statement in Ruby that executes a block of code only if a specified condition is false. It's essentially the opposite of `if`. If the condition provided to `unless` evaluates to false, the code block is executed; otherwise, the code block is skipped. It provides a more readable way to express negative conditions.
Visit the following resources to learn more:
- [@article@Unless statements](https://www.theodinproject.com/lessons/ruby-conditional-logic#unless-statements)
- [@article@Read This Post 'Unless' You're Not A Ruby Developer](https://jesseduffield.com/Unless/)
- [@video@Ruby Programming Tutorial - 16 - unless](https://www.youtube.com/watch?v=2iysMciUQpw)

View File

@@ -1,3 +1,10 @@
# Until Loop
The `until` loop in Ruby executes a block of code as long as a specified condition is false. It repeatedly runs the code within the loop until the condition becomes true. Think of it as the opposite of a `while` loop; where `while` loops continue as long as the condition is true, `until` loops continue as long as the condition is false.
The `until` loop in Ruby executes a block of code as long as a specified condition is false. It repeatedly runs the code within the loop until the condition becomes true. Think of it as the opposite of a `while` loop; where `while` loops continue as long as the condition is true, `until` loops continue as long as the condition is false.
Visit the following resources to learn more:
- [@article@Until loop](https://www.theodinproject.com/lessons/ruby-loops#until-loop)
- [@article@5.3 Until Loops](https://www.oreilly.com/library/view/computer-science-programming/9781449356835/fivedot3_until_loops.html)
- [@article@Ruby - Loops](https://www.tutorialspoint.com/ruby/ruby_loops.htm)
- [@video@Ruby Programming Tutorial | Until Loops](https://www.youtube.com/watch?v=Y32UnAPHJm4)

View File

@@ -1,3 +1,9 @@
# While Loops in Ruby
A `while` loop in Ruby repeatedly executes a block of code as long as a specified condition is true. It checks the condition before each iteration, and if the condition is false from the start, the code block is never executed. This makes it suitable for situations where you want to execute code an unknown number of times until a certain condition is met.
A `while` loop in Ruby repeatedly executes a block of code as long as a specified condition is true. It checks the condition before each iteration, and if the condition is false from the start, the code block is never executed. This makes it suitable for situations where you want to execute code an unknown number of times until a certain condition is met.
Visit the following resources to learn more:
- [@article@While Loops](https://www.theodinproject.com/lessons/ruby-loops#while-loop)
- [@article@Ruby while Loop](https://www.programiz.com/ruby/while-loop)
- [@video@While Loops | Ruby | Tutorial 21](https://www.youtube.com/watch?v=3bXd6h8Zsfk)