Skip to content

changed the while statement in the while-loop example#10843

Merged
oxzi merged 2 commits into
Icinga:masterfrom
MisterMountain:docs/language-ref-while-loops
May 12, 2026
Merged

changed the while statement in the while-loop example#10843
oxzi merged 2 commits into
Icinga:masterfrom
MisterMountain:docs/language-ref-while-loops

Conversation

@MisterMountain
Copy link
Copy Markdown
Contributor

...as the previous example didnt make much sense:
current:

var num = 5

while (num > 5) {
    log("Test")
    num -= 1
}

new:

var num = 5

while (num > 0) {
    log("Test")
    num -= 1
}

In the current example, the while loop would never do anything as while (5 >5) is false, so no "Test" would be logged. With while (num > 0) we will get 5 times "Test" in our log :)

… 0), as the previous example didnt make much sense.
@cla-bot cla-bot Bot added the cla/signed label May 12, 2026
@oxzi oxzi self-assigned this May 12, 2026
@oxzi oxzi added the area/documentation End-user or developer help label May 12, 2026
@oxzi oxzi added this to the 2.17.0 milestone May 12, 2026
Copy link
Copy Markdown
Member

@oxzi oxzi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$ icinga2 console
Icinga 2 (version: v2.16.0-16-gf50f6ec88)
Type $help to view available commands.
<1> => var num = 5
null
<2> =>
while (num > 5) {
    log("Test")
    num -= 1
}
null
<3> => num
5.000000
<4> =>
while (num > 0) {
    log("Test")
    num -= 1
}
information/config: Test
information/config: Test
information/config: Test
information/config: Test
information/config: Test
null
<5> => num
0.000000

Thanks!

Copy link
Copy Markdown
Member

@oxzi oxzi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops, please add yourself to the AUTHORS file as the failing CI job suggests. I somehow assumed you were already in there.

@oxzi oxzi removed their assignment May 12, 2026
@oxzi oxzi enabled auto-merge May 12, 2026 07:23
@oxzi oxzi merged commit 6c73bb4 into Icinga:master May 12, 2026
30 checks passed
@MisterMountain MisterMountain deleted the docs/language-ref-while-loops branch May 12, 2026 10:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/documentation End-user or developer help cla/signed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants