generated from LEARNAcademy/ruby-challenges
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathblocks-keoni.rb
46 lines (34 loc) · 1.12 KB
/
blocks-keoni.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#1 Create a loop that prints the numbers 1 to 20.
# for counting in 1..20
# puts counting
# end
#2 Create a loop that prints the numbers 1 to 20 using a different approach than previously used
# counter = 1
# while counter <= 20
# puts counter
# counter =+ 1
# end
#3 Create a loop that prints only even numbers from 20 to 0
# num = 20
# while num >= 0
# p num
# num -= 2
# end
#4 Create a method that takes in an array of numbers and returns a new array with all the numbers multiplied by 5
# variable_name = [2, 4, 6, 8, 10]
# cooler_variable_name = variable_name.map do |value|
# value * 5
# end
# puts cooler_variable_name
#5 Create a method that takes in an array of lowercase words and capitalizes all of the words, permanently modifying the original array.
# gas_giants = ['neptume', 'uranus', 'saturn', 'jupiter']
# def upper_case planets
# planets.map!(&:capitalize!)
# end
# upper_case(gas_giants)
# puts gas_giants
#6 Create a method that takes in an array of numbers and returns the largest number in the array
num_bah = [24, 42, 69, 420, 5318008]
def highest(numbers)
highest_number
end