Sha256: e48bdb1c60604e3090566217a1cb2d137d6c352619972bf6a0c5b960225b0d97

Contents?: true

Size: 917 Bytes

Versions: 547

Compression:

Stored size: 917 Bytes

Contents

Puppet::Parser::Functions::newfunction(
  :break,
  :arity => 0,
  :doc => <<-DOC
Breaks the innermost iteration as if it encountered an end of input.
This function does not return to the caller.

The signal produced to stop the iteration bubbles up through
the call stack until either terminating the innermost iteration or
raising an error if the end of the call stack is reached.

The break() function does not accept an argument.

**Example:** Using `break`

```puppet
$data = [1,2,3]
notice $data.map |$x| { if $x == 3 { break() } $x*10 }
```

Would notice the value `[10, 20]`

**Example:** Using a nested `break`

```puppet
function break_if_even($x) {
  if $x % 2 == 0 { break() }
}
$data = [1,2,3]
notice $data.map |$x| { break_if_even($x); $x*10 }
```
Would notice the value `[10]`

* Also see functions `next` and `return`
* Since 4.8.0
DOC
) do |args|
  Puppet::Parser::Functions::Error.is4x('break')
end

Version data entries

547 entries across 547 versions & 3 rubygems

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