marks = -85 case marks when 0..59 puts “You got an F” when 60..69 puts “You got a D grade !” when 70..79 puts “You got a C grade!” when 80..89 puts “You got a B grade!” else puts “You got an A grade!” end What will be the output when marks = -85 ?
digits = -1..9 puts digits.min puts digi…
digits = -1..9 puts digits.min puts digits.max What will be the output from the code above ?
number = 0is_even = ->(x) { x % 2 == 0 }case number when 0 t…
number = 0is_even = ->(x) { x % 2 == 0 }case number when 0 then puts ‘zero’ when is_even then puts ‘even’ else puts ‘odd’ end What is the output ?
taxrate = 0.125print “Enter price: “s = getssubtotal = s.to_…
taxrate = 0.125print “Enter price: “s = getssubtotal = s.to_fif (subtotal < 0.0) then subtotal = 0.0endtax = subtotal * taxrateputs "Tax on $#{subtotal} is $#{tax}, so grand total is $#{subtotal+tax}" The end keyword that terminates the if block is optional in the code above.
Variables in Ruby can be embedded into the string itself by…
Variables in Ruby can be embedded into the string itself by using #{variable_name}.
for num in 1..5 puts num*num endWhat is the output from the…
for num in 1..5 puts num*num endWhat is the output from the code ?
Ruby is case sensitive.
Ruby is case sensitive.
What is your favorite aspect of the course so far?
What is your favorite aspect of the course so far?
Detritivores include ________.
Detritivores include ________.
Select all correct answers. The causes of the current (sixth…
Select all correct answers. The causes of the current (sixth) mass extinction include all of the following: