repeat (Function)

Signature: repeat(s: string, n: int) -> Result<string, Error>

Description: Concatenates s with itself n times. A negative n returns Error.

Parameters

  • s (string): The string to repeat
  • n (int): Repeat count, must be >= 0

Returns: Result<string, Error>

Example

repeat("ab", 3)  // Success { value: "ababab" }
repeat ("ab", 3)  // Success { value: "ababab" }