Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
bouyagas committed Jun 6, 2014
1 parent 08a19b8 commit a95986f
Showing 1 changed file with 24 additions and 16 deletions.
40 changes: 24 additions & 16 deletions assignment.rb
Original file line number Diff line number Diff line change
@@ -1,30 +1,38 @@
#string interpolation

x = "You're"
puts "#{x} only in America!"

#finding the max number

x = [100,10,-1000]
puts x.max



# converting array to hashs
[:toyota,:tesla]
["prius","model S"]

hash = [[:toyota, 'prius'], [:tesla, 'model S']].inject({}) do |result, element|
result[element.first] = element.last
result
end

puts hash


#looping
(1..100).each{|i|
x = ''
x += 'Fizz' if i%3==0
x += 'Buzz' if i%5==0
puts(x.empty? ? i : x);
}


#finding the max number
x = [100,10,-1000]
x.max


# converting array to hashs
keys = [:toyota,:tesla]
values = ["prius","model S"]

hash = {}
keys.each_with_index { |key, index| hash[key] = values[index] }


#looping
def integer(number)
n = 1
while n < 100
puts number
n = n + 1
end
end

0 comments on commit a95986f

Please sign in to comment.