Skip to content

Commit

Permalink
(maint) Merge up 7b4daa2 to main
Browse files Browse the repository at this point in the history
Generated by CI

* commit '7b4daa2d34a72b82626c37c0290317efb7c993f8':
  (docs) Add example for next()
  • Loading branch information
puppetlabs-jenkins committed Jan 21, 2022
2 parents a5a7760 + 7b4daa2 commit 389dbf6
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion lib/puppet/functions/next.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,25 @@
# Makes iteration continue with the next value, optionally with a given value for this iteration.
# If a value is not given it defaults to `undef`
#
# @example Using the `next()` function
#
# @since 4.7.0
# ```puppet
# $data = ['a','b','c']
# $data.each |Integer $index, String $value| {
# if $index == 1 {
# next()
# }
# notice ("${index} = ${value}")
# }
# ```
#
# Would notice:
# ```
# Notice: Scope(Class[main]): 0 = a
# Notice: Scope(Class[main]): 2 = c
# ```
#
# @since 4.7.0
Puppet::Functions.create_function(:next) do
dispatch :next_impl do
optional_param 'Any', :value
Expand Down

0 comments on commit 389dbf6

Please sign in to comment.