Monday, March 27, 2023

Coding Challenge #34

 # Edabit challenge "Convert Age to Days"
# in Ruby
# trying a new language...
def ageToDays(years)
    return years * 365
end

def test(n)
    puts "An age of " + n.to_s + " has passed " + ageToDays(n).to_s + " days."
end

test(1)
test(3)
test(5)
test(10)
test(89)
test(130)

No comments:

Post a Comment

Coding Challenge #54 C++ int to std::string (no stringstream or to_string())

Gets a string from an integer (ejemplo gratis: 123 -> "123") Wanted to come up with my own function for this like 10 years ago ...