Extract balloon generation to its own function
This commit is contained in:
parent
f1e91e5963
commit
e6e38b94ed
1 changed files with 8 additions and 2 deletions
|
@ -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
|
||||||
|
|
Loading…
Reference in a new issue