Ruby - Methods - Keyword Arguments

Run Settings
LanguageRuby
Language Version
Run Command
def convert_temp(initial, input_scale, output_scale: 'celcius') if input_scale == "celcius" && output_scale == "fahrenheit" # do something return (initial * 9/5) + 32 elsif input_scale == "celcius" && output_scale == "kelvin" # do something return initial + 273.15 elsif input_scale == "kelvin" && output_scale == "fahrenheit" # do something return (initial – 273.15) * 9/5 + 32 elsif input_scale == "kelvin" && output_scale == "celcius" # do something return (initial – 273.15) elsif input_scale == "fahrenheit" && output_scale == "celcius" # do something return (initial – 32) * 5/9 elsif input_scale == "fahrenheit" && output_scale == "kelvin" # do something return (initial – 32) * 5/9 + 273.15 end end answer = convert_temp(300.0,"kelvin") puts answer
Editor Settings
Theme
Key bindings
Full width
Lines