Other Nim solutions.
import strformat
proc twoFer*(name = "you"): string =
&"One for {name}, one for me."
Other Python solutions.
def two_fer(name="you"):
return f"One for {name}, one for me."
Other Clojure solutions.
(ns two-fer)
(defn two-fer
([] (two-fer "you"))
([name] (format "One for %s, one for me." (or name "you"))))
Other Elm solutions.
module TwoFer exposing (twoFer)
twoFer : Maybe String -> String
twoFer name =
"One for " ++ Maybe.withDefault "you" name ++ ", one for me."
Other Roc solutions.
module [twoFer]
twoFer : [Name Str, Anonymous] -> Str
twoFer = \name ->
word =
when name is
Anonymous -> "you"
Name n -> n
"One for $(word), one for me."