JanetDocsPlaygroundI'm feeling luckyGitHub sign in

forv



    macro
    boot.janet on line 496, column 1

    (forv i start stop & body)

    Do a C-style for-loop for side effects. The iteration variable `i` 
    can be mutated in the loop, unlike normal `for`. Returns nil.


2 examplesSign in to add an example
Loading...
(forv i 0 10
 (print "hello"))

# => hello
# => hello
# => hello
# => hello
# => hello
# => hello
# => hello
# => hello
# => hello
# => hello
# => nil
jgartePlayground
(do
  (var coll @[])
  (forv i 0 9
    (array/push coll i)
    (+= i 2))
  coll)
# => @[0 3 6]
sogaiuPlayground