name :bmi

execute do
	raise FieldError.new("weight", "weight must be a number") if !field_weight.is_float?
	raise FieldError.new("height", "height must be a number") if !field_height.is_float?

	weight = field_weight.to_f
	height = field_height.to_f

	raise FieldError.new("weight", "weight must be greater than zero") if weight <= 0
	raise FieldError.new("height", "height must be greater than zero") if height <= 0

	weight / (height ** 2)
end

name :bmi
require_helpers :get_field_as_float

execute do
	weight = get_field_as_float :weight
	height = get_field_as_float :height

	raise FieldError.new("weight", "weight must be greater than zero") if weight <= 0
	raise FieldError.new("height", "height must be greater than zero") if height <= 0

	weight / (height ** 2)
end

Use new helper methods for getting fields
Use new helper methods for getting fields
