I'm not entirely sure why, but I can't figure out how to join an array in Nim, here's the code:
import std/strformat
proc check(to: int, multi: int, toreturn: string): string =
if to mod multi == 0:
return toreturn
else:
return ""
proc ifempty(str :string, num: int): string =
if len(str) == 0:
return fmt"{num}"
else:
return str
var i: int = 1
while i <= 100:
var checks = @[check(i, 3, "Fizz"), check(i, 5, "Buzz")]
let toecho = ifempty(checks.join(""), i)
echo(toecho)
inc(i)
I'm expecting it to join the array, but all I get is the error
/home/runner/FavoriteJointLists/main.nim(18, 30) Error: attempting to call undeclared routine: 'join' exit status 1