Extract balloon generation to its own function

This commit is contained in:
Thomas A. Christensen II 2022-01-11 18:54:28 -06:00
parent f1e91e5963
commit e6e38b94ed
Signed by: millironx
GPG key ID: 139C07724802BC5D

View file

@ -92,6 +92,11 @@ a cow function **must**
6. Have fun! 6. Have fun!
""" """
function cowsay(message::AbstractString; cow=default, eyes="oo", tongue=" ") function cowsay(message::AbstractString; cow=default, eyes="oo", tongue=" ")
balloon = sayballoon(message)
println(string(balloon, cow(eyes=eyes, tongue=tongue)))
end
function sayballoon(message::AbstractString)
messagelines = split(message, "\n") messagelines = split(message, "\n")
nlines = length(messagelines) nlines = length(messagelines)
@ -136,8 +141,9 @@ function cowsay(message::AbstractString; cow=default, eyes="oo", tongue=" ")
) )
end end
println(string(balloon, cow(eyes=eyes, tongue=tongue))) return balloon
end
end #function
end end