Module:Sandbox/RexxS/GCI06

Revision as of 16:01, 16 December 2017 by imported>RexxS (fix as number)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Documentation for this module may be created at Module:Sandbox/RexxS/GCI06/doc

-- Module to demonstrate a numerical comparison for Google-Code-in-2017
-- Function temperature returns conversion and text for a given input in Celsius

p = {}

p.temperature = function(frame)
	cel = tonumber(frame.args.celsius) or 0
	fah = (cel * 9 / 5) + 32
	msg = cel .. " degrees Celsius is " .. fah .. " degrees Fahrenheit.<br>"
	if cel > 9 then
		msg = msg .. "It is warm.<br>"
	else
		msg = msg .. "It is cold.<br>"
	end
	return msg
end

return p