Sha256: 10af53b8c7ebb9b5bfa9dcc4c6d814b3e5adb26233487ecf9ec514c4c497394e

Contents?: true

Size: 759 Bytes

Versions: 96

Compression:

Stored size: 759 Bytes

Contents

# 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
#
# ```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
  end

  def next_impl(value = nil)
    file, line = Puppet::Pops::PuppetStack.top_of_stack
    exc = Puppet::Pops::Evaluator::Next.new(value, file, line)
    raise exc
  end
end

Version data entries

96 entries across 96 versions & 1 rubygems

Version Path
puppet-7.34.0 lib/puppet/functions/next.rb
puppet-7.34.0-x86-mingw32 lib/puppet/functions/next.rb
puppet-7.34.0-x64-mingw32 lib/puppet/functions/next.rb
puppet-7.34.0-universal-darwin lib/puppet/functions/next.rb
puppet-7.33.0 lib/puppet/functions/next.rb
puppet-7.33.0-x86-mingw32 lib/puppet/functions/next.rb
puppet-7.33.0-x64-mingw32 lib/puppet/functions/next.rb
puppet-7.33.0-universal-darwin lib/puppet/functions/next.rb
puppet-7.32.1 lib/puppet/functions/next.rb
puppet-7.32.1-x86-mingw32 lib/puppet/functions/next.rb
puppet-7.32.1-x64-mingw32 lib/puppet/functions/next.rb
puppet-7.32.1-universal-darwin lib/puppet/functions/next.rb
puppet-7.31.0 lib/puppet/functions/next.rb
puppet-7.31.0-x86-mingw32 lib/puppet/functions/next.rb
puppet-7.31.0-x64-mingw32 lib/puppet/functions/next.rb
puppet-7.31.0-universal-darwin lib/puppet/functions/next.rb
puppet-7.30.0 lib/puppet/functions/next.rb
puppet-7.30.0-x86-mingw32 lib/puppet/functions/next.rb
puppet-7.30.0-x64-mingw32 lib/puppet/functions/next.rb
puppet-7.30.0-universal-darwin lib/puppet/functions/next.rb