Skip to content

Commit

Permalink
Merge pull request #194 from turingschool/fast-track
Browse files Browse the repository at this point in the history
Fast track
  • Loading branch information
KatBrandt authored Sep 22, 2023
2 parents ef0584d + 0d19953 commit cb2455e
Show file tree
Hide file tree
Showing 27 changed files with 1,513 additions and 275 deletions.
51 changes: 26 additions & 25 deletions back-end/arrays.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ Notice that in the previous examples, the items in a given list are all of the _
students = ["Cindy", "Josiah", "Rigo"]
```

>To describe what the previous line of code does, one might say, "The `students` variable stores an Array of Strings. This array has 3 elements."
>To describe what the previous line of code does, one might say, "The `students` variable stores an Array of Strings representing student names. This array has 3 elements."
<br>
<div class="s-card">
Expand All @@ -72,7 +72,7 @@ students = ["Cindy", "Josiah", "Rigo"]

### Accessing Elements

To access one element from an array, bracket notation and a number that corresponds with that element should be used. As weird as it may seem, <a href="https://skillcrush.com/blog/why-programmers-start-counting-at-zero/" target="_blank">counting starts with 0 in most programming languages</a>. That number is referred to as an <span class="vocab">index position</span>.
To access one element from an array we use bracket notation and a number that corresponds with that element. That number is referred to as an <span class="vocab">index position</span>. As weird as it may seem, <a href="https://skillcrush.com/blog/why-programmers-start-counting-at-zero/" target="_blank">counting starts with 0 in most programming languages</a>.

Through reading the code snippets below, one can infer that the first element is in index position 0, and counting increments by 1.

Expand Down Expand Up @@ -124,15 +124,34 @@ puts students[2]
</div>
<br>

## Practice

Create a new project (aka directory). Make 1 file - `arrays.rb`. In that file:
- Declare a variable that stores an Array of at least 4 Strings.
- Declare a variable that stores an Array of at least 4 Integers.
- Declare a variable that stores an Array of at least 4 Floats.
- Declare a variable that stores an Array of at least 4 Booleans.
- [_Intentionally open-ended_] Demonstrate your understanding of index positions in this file. You can write an explanation, provide some examples with the Arrays you've created, or anything else.

## Check For Understanding

Please create a section in your Mod 0 Gist for **Arrays** and record your answers to these questions. (Including the question is very helpful!)
- How confident do you feel with the content on Arrays so far?
- Is there any additional learning you need or want to do before moving to the next lesson?
- What questions do you have about Arrays?

## Extension
The work below is meant as optional work to be completed and explored outside of the live Mod 0 sessions. This work is encouraged, but not required.

### Array Methods

In most cases, a developer want to modify data in an Array at one point or another. Today, we will learn a number of ways to do that. They will probably not satisfy your every question of "How does X app do Y?" but this will lay an important foundation for the concept of Array methods, and some strategies to get that information you are craving!
At one point or another, a developer will need to modify data in an Array. Today, we will learn a number of ways to do that. They will probably not satisfy your every question of "How does X app do Y?" but this will lay an important foundation for the concept of Array methods and some strategies to get that information you are craving!

An Array <span class="vocab">method</span> is a piece of functionality that is built into the Ruby language, intended to be used on Arrays specifically. Each method has a specific job to perform; we can use it if we want, but we can't modify a built-in method. There are many Array methods - like anything else in programming, you will memorize a handful that you regularly use, then look to documentation for those you don't use as regularly.

### Array Methods Syntax

To use an Array method in Ruby, we first must tell Ruby which Array we want to perform the method on. After that, a dot or period, followed by the name of the method.
To use an Array method in Ruby, we first must tell Ruby which Array we want to perform the method on. After that, a dot or period (called dot syntax), followed by the name of the method.

```ruby
students = ["Cindy", "Josiah", "Rigo"]
Expand All @@ -143,6 +162,7 @@ p students

>To describe what the previous line of code does, one might say, "This line of code calls the `pop` method on the `students` Array."

<br>

### Learning From Reading Code You Don't Know
Expand All @@ -153,38 +173,19 @@ Since researching and reading documentation can sometimes be time-consuming, ano

<div class="s-card">
<h3>Array Methods & Learning Strategies:</h3>
<p>You've seen the syntax for the <code>pop</code> method but its utility was not explained. Before going down a potential rabbit hole in Google, open up <code>irb</code>. Declare an Array with 3 elements. Use the <code>pop</code> method with the syntax you learned earlier. Call the Array and observe the change that has been made since you initially declared it. Go through this process again, with the same Array. What can you infer the <code>pop</code> method does? Check Google (remember, ruby-docs has the most reliable documentation) to confirm your inference. Write this down!</p>
<p>You've seen the syntax for the <code>pop</code> method but its utility was not explained. Before going down a potential rabbit hole in Google, open up <code>irb</code>. Declare an Array with 3 elements. Use the <code>pop</code> method with the syntax you learned earlier. Call the Array and observe the change that has been made since you initially declared it. Go through this process again, with the same Array. What can you infer the <code>pop</code> method does? Check Google (remember, <code>ruby-docs</code> has the most reliable documentation) to confirm your inference. Write this down!</p>
<p>Your next task is to learn what the <code>push</code>, <code>shift</code> and <code>unshift</code> Array methods do. Consider - how easy or hard did the work you did for <code>pop</code> feel? Do you want to follow the same steps to learn about the other methods, or go straight to ruby documentation to learn about the other 3? Act on whatever you decide, and be sure to write down your learnings about these methods.</p>
</div>
<br>

<div class="s-card">
<h3>Talking and Writing about Code</h3>
<p>In your notebook, write down the code that follows, then write a sentence that describes what that line of code does:</p>
<p><code>ticket_prices = [87, 67, 99, 90, 87]</code></p>
<p><code>ticket_prices.length</code></p>
</div>

## Check For Understanding

Create a new project (aka directory) and initialize a Git repository in it. Make 1 file - `arrays.rb`, and _make an initial commit_. In that file:
- Declare a variable that stores an Array of at least 4 Strings.
- Declare a variable that stores an Array of at least 4 Integers.
- Declare a variable that stores an Array of at least 4 Floats.
- Declare a variable that stores an Array of at least 4 Booleans.
- _Commit your work_.
- Call 1 of each of the 4 methods you learned, on each of the 4 arrays you created above. On the line of code above that, write (<a href="https://www.thoughtco.com/commenting-ruby-code-2908193#:~:text=Single%2DLine%20Comments,line%3B%20it%20can%20occur%20anywhere" target="_blank">in a Ruby comment</a>) an explanation in plain English as to what impact calling that method will have on that specific array.
- _Commit your work_.
- [_Intentionally open-ended_] Demonstrate your understanding of index positions in this file. You can write an explanation, provide some examples with the Arrays you've created, or anything else.
- _Commit your work_.
- Use the <a href="https://ruby-doc.org/core-2.7.2/Array.html" target="_blank">Ruby Documentation</a> to learn about one additional Array method of your choice. Provide an explanation and example to demonstrate your understanding of it. (Consider bookmarking the official Array docs!)
- _Commit your work_.

Create another file in the same directory, name it `self-evaluation.md`. In Markdown, answer the following questions:
- How confident do you feel with the content on Arrays so far?
- Is there any additional learning you need or want to do before moving to the next lesson?
- What questions do you have about Arrays?
- _Commit your work_.

After you've completed the tasks above, push your work up to a new GitHub repository. Provide the GitHub repository link in the submission form.

<br><br><br>
28 changes: 17 additions & 11 deletions back-end/conditionals.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,9 @@ end
The following example checks if a store is open, and prints out a statment if the store is indeed open:

```ruby
is_open = true
greeting = "Hello"

if is_open == true
if greeting == "Hello"
puts "Let's go!"
end
```
Expand All @@ -110,15 +110,15 @@ end

### `else`

In the previous exercises, when the condition evaluates to false, we don't see any output. In order to have a default response that runs when the condition is false, we need an `else` statement. Here's an example with the `is_open` variable for the store.
In the previous exercises, when the condition evaluates to false, we don't see any output. In order to have a default response that runs when the condition is false, we need an `else` statement. Here's an example with the `greeting` variable for the store.

```ruby
is_open = true
greeting = "Hello"

if is_open == true
if greeting == "Hello"
puts "Let's go!"
else
puts "Oops. Looks like that store is closed now."
puts "Goodbye then."
end
```

Expand Down Expand Up @@ -166,13 +166,18 @@ Notice that each of the previous examples have **one** `end` keyword. That is pa
</ul>
</div>

## Self-Teach
Part of what you'll experience at Turing is learning a technical topic on your own. Practicing this skill at Turing will get you prepared for the job where you will do this often.

Take time between now and your next session to self-teach the following section.

## Logical Operators

There are three <span class="vocab">logical operators</span> in Ruby; we will learn two today:
- `&&` or `and`
- `||` or `or`
- `&&` (Logical And Operator)
- `||` (Logical Or Operator)

### `&&` or `and`
### `&&`

This logical operator will check two values, and both **must** be true in order for it to return `true`. Examples follow:

Expand All @@ -193,7 +198,7 @@ age < 30 && time < 2.0
# false (neither meet requirement)
```

### `||` or `or`
### `||`
This logical operator will check two values, and _one_ or _both_ must be true in order for it to return true. Examples follow:

```ruby
Expand Down Expand Up @@ -240,6 +245,7 @@ Now that you know about logical operators and `if statements`, let's combine tha

## Check For Understanding

<a href="https://github.com/turingschool/m0_be_conditionals" target="_blank">Follow the directions in the README of this GitHub repository</a>, and submit your fork in the submission form.
- <a href="https://github.com/turingschool/m0_be_conditionals" target="_blank">Follow the directions in the README of this GitHub repository</a>.
- Add the link to your repository to your Mod 0 Gist in a section called `Conditionals`.

<br><br><br>
32 changes: 14 additions & 18 deletions back-end/data_types.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,14 @@ To connect to how these data types are used in an application we all have some e

<div class="s-card">
<h3>Deciding on a Data Type</h3>
<p>For each of the items listed below, determine which Data Type seems most appropriate to store it as. If you are unsure of any, start a discussion in your Slack small group.</p>
<p>For each of the items listed below, determine which Data Type seems most appropriate to store it as. If you are unsure of any, start a discussion in your Slack group.</p>
<ul>
<li>Username/handle</li>
<li>Date of Birth</li>
<li>Age</li>
<li>Number of Likes</li>
<li>Balance on a bank account</li>
<li>Zip Code</li>
<li>Currently online</li>
<li>Daily countdown to a big event</li>
<li>Caption for an image</li>
Expand Down Expand Up @@ -121,7 +122,9 @@ We often need to write code that changes the data stored in a variable. Consider
- When a student first creates a profile, the `deposit_paid` variable is automatically assigned to `false`.
- Once the student pays their deposit, some code is triggered to change that value to `true`.

To do that, we use the exact same syntax that we used to make the original assignment. We can run the code that follows, or code like it, in `irb` to demonstrate that the value has changed.
To do that, we use the exact same syntax that we used to make the original assignment.

Run the code that follows in `irb` to demonstrate that the value has changed.

```ruby
# the deposit_paid variable is declared and assigned to the boolean value false
Expand Down Expand Up @@ -151,32 +154,25 @@ In an irb session, simply calling a variable returns the value stored in that va

In order to visually see the return value of a variable, we can use the `puts` or `print` command before any variable or even data to see that value printed to the console. Take a look at <a href="https://replit.com/@turingschool/ruby-puts-print#main.rb" target="blank">this replit</a> to see those commands in action.

## Check For Understanding

_Complete this CFU **after** you've done the live GitHub lesson._
## Practice

Use everything you’ve learned with Git, GitHub, Data Types and variables, complete this challenge:
*Note:* If at anytime you have questions, please ask them in your slack channel. This is the main resource we will use for asking questions at Turing.

1. Create a new directory called `variable_practice`.
1. Inside that directory, create a file called `variables.rb`.
1. Initialize `git` inside of the directory.
1. Commit your work (Think about what message should you use here).
1. Go to GitHub and create a repository with the same name - `variable_practice`.
1. Push your local directory to GitHub by following the instructions.
1. In your `variables.rb` file, add a few variables that are assigned to Strings.
1. Commit your work.
1. In your `variables.rb` file, add a few variables that are assigned to Integers.
1. Commit your work.
1. In your `variables.rb` file, add a few variables that are assigned to Floats.
1. Commit your work.
1. In your `variables.rb` file, add a few variables that are assigned to Booleans.
1. Commit your work.
1. In your `variables.rb` file, leave the original String variables as declared, but add some code to _reassign_ them to different values.
1. Write several `puts` statements.
1. `NEW` Run your code by going to the Terminal and running `ruby variables.rb` - make sure you are inside the `variable_practice` directory when doing so.
1. Commit your work.
1. Push your changes to GitHub.
1. `NEW` Run your code by going to the Terminal and typing `ruby variables.rb` - make sure you are inside the `variable_practice` directory when doing so. You should see the output of your ruby file in the terminal. If done correctly, where ever you have a `puts` or `print` statement, what follows should print to your terminal.

## Check For Understanding

Please submit the link to your GitHub repository in the submission form.
Please create a section in your Mod 0 Gist for **Data Types** and record your answers to these questions. (Including the question is very helpful!)
- How confident do you feel with the content on Data Types so far?
- Is there any additional learning you need or want to do before moving to the next lesson?
- What questions do you have about Data Types?

<br><br>
Loading

0 comments on commit cb2455e

Please sign in to comment.