雨滴是 FizzBuzz 挑戰稍微複雜一點的版本,也是經典的面試題目喔。
你的任務是把一個數字轉換成對應的雨滴聲。
如果給定的數字:
"Plong"。"PlingPlang"。"34"。在這個練習中,你會實作一個程序,它負責配置自己回傳的字串。釋放字串則是呼叫端的責任。
// The procedure will be called like that:
converted := convert(3)
// ...
// and eventually the caller will delete the string
delete(converted)