Skip to content

Commit

Permalink
refactor: use modulo
Browse files Browse the repository at this point in the history
  • Loading branch information
maelle committed Feb 24, 2025
1 parent 48b44af commit f20a031
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion R/mock2-helpers.R
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ mock_output_sequence <- function(values, recycle = FALSE) {
i = "You can set {.arg recycle} to {.code TRUE}."
))
}
value <- rep_len(values, length.out = i)[[i]]
index <- (i - 1) %% length(values) + 1
value <- rep_len(values, length.out = index)[[index]]
i <<- i + 1
value
}
Expand Down

0 comments on commit f20a031

Please sign in to comment.