head_first_ruby_methods_classes.rb
def mileage (miles_driven, gas_used)
  if gas_used == 0
    return 0.0
    #return will stop any further calculations taking place if 0
  end
  miles_driven / gas_used
end
#return key useful for situations when running code would be pointless or harmful
#dividing anything by zero causes an error
return key useful for situations when running code would be pointless or harmful
dividing anything by zero causes an error
return key useful for situations when running code would be pointless or harmful dividing anything by zero causes an error
def mileage (miles_driven, gas_used)
  if gas_used == 0
    return 0.0
  end
  miles_driven / gas_used
end
def mileage ( miles_driven , gas_used ) if gas_used == 0 return 0.0 end miles_driven / gas_used end
return key useful for situations when running code would be pointless or harmful
dividing anything by zero causes an error
return key useful for situations when running code would be pointless or harmful dividing anything by zero causes an error
#return will stop any further calculations taking place if 0
miles_driven
gas_used