Merge pull request #31 from jtruman88/jaron-truman-fix-typo-in-target-practice

Fix Typo in Target Practice
This commit is contained in:
Brett Chalupa 2024-02-29 13:18:18 -05:00 committed by GitHub
commit 76dbefeca9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -89,7 +89,7 @@ We'll go about this in the following way:
- If a target should be removed, then we'll mark it as `dead` - If a target should be removed, then we'll mark it as `dead`
- After we've checked all of our targets, we'll `reject!` the dead ones from `args.state.targets` - After we've checked all of our targets, we'll `reject!` the dead ones from `args.state.targets`
Ruby makes that pretty easy. All you do is call the `#reject!` method on an array and pass in the logic for when an item should be removed. If you have an array of numbers and call reject on all of the numbers, only the odd ones will remain in the array: Ruby makes that pretty easy. All you do is call the `#reject!` method on an array and pass in the logic for when an item should be removed. If you have an array of numbers and call reject on all of the even numbers, only the odd ones will remain in the array:
``` ruby ``` ruby
nums = [3, 4, 5] nums = [3, 4, 5]