Last active
April 14, 2022 03:16
-
-
Save caioertai/e0afbd13a2d3de6e0012f1de281df807 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Declare an array literal | |
# Array CRUD |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Range | |
# .. | |
# ... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Let's loop with the array | |
characters = ["Hank", "Sheila", "Bob"] | |
# for when given an array | |
# Let's loop with just the indexes |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 0 1 2 3 | |
characters = ["Hank", "Sheila", "Bob", "Erik"] | |
# Let's print hi to all of them | |
# Hi, Hank! ... etc | |
# Print characters as a numbered list | |
# 1. Hank ... etc |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
characters = [ | |
"Hank the Ranger", | |
"Sheila the Thief", | |
"Bob the Barbarian", | |
"Erik the Knight" | |
] | |
# Let's change our array to a new array: | |
# - upcased names | |
# - first names |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
characters = ["Diana", "Bob", "Dungeon Master", "Erik"] | |
# Let's count the names starting with D |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
characters = ["Hank", "Dungeon Master", "Bob", "Diana"] | |
# Select (filter) names starting with D | |
# Reject (filter out) names starting with D |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# What_is_this? | |
method_name do |param| | |
"code goes here" | |
end | |
# And_this? | |
method_name { |param| "code goes here" } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Let's write a benchmark tool using yield |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## A method, with a block for the message, that can output the | |
## following from first and last name as args. | |
# Olá, <fully_sanitized_and_styled_person_name>. Como é que tu estás? | |
# Como estás, <fully_sanitized_and_styled_person_name>? | |
# Hey, <fully_sanitized_and_styled_person_name>, how are you? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment