Skip to content

While loops and try/except examples#3

Open
falk7 wants to merge 7 commits into
robotframework:gh-pagesfrom
imbus:gh-pages
Open

While loops and try/except examples#3
falk7 wants to merge 7 commits into
robotframework:gh-pagesfrom
imbus:gh-pages

Conversation

@falk7
Copy link
Copy Markdown

@falk7 falk7 commented May 23, 2023

No description provided.

Comment thread Examples/FOR_Loops/3_in_range.robot Outdated
Loop 10 times starting with 1
Log To Console start: 1 ,inc: 1 , end:11
Log To Console start: 1 ,inc: 1 , end:10
FOR ${num} IN RANGE 1 10
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Ich glaub hier müsste eher das IN RANGE geändert werden, oder?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Loop 10 times starting with 1
    Log To Console    start: 1 ,inc: 1 , end:11
    FOR    ${num}    IN RANGE    1    11
        Log To Console    ${num}
    END

oder eben 9 times

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

oder so. end im Log To Console muss dann aber trotzdem 10 sein, weil das Ende im IN RANGE ja exklusiv ist

Loop 10 times starting with 1
    Log To Console    start: 1 ,inc: 1 , end:10
    FOR    ${num}    IN RANGE    1    11
        Log To Console    ${num}
    END

Exit For Loop If ${num} == 0
Sleep 1sec
END
Log To Console 🎉🥳 HAPPY NEW YEAR !!! 🍾 No newline at end of file
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Wenn du es bei 0 enden lässt, kommt die 0 nie.
Die Idee hier war auch das Exit bzw BREAK zu zeigen.

Ich würde es so ändern.

Countdown from 10 to 0 in 10 seconds
    Log To Console    start: 10 ,inc: -1 , end: -1
    FOR    ${num}    IN RANGE    10    -1    -1
        Log To Console    ${num}
        IF    ${num} == 0    BREAK
        Sleep   1sec
    END
    Log To Console    🎉🥳 HAPPY NEW YEAR !!! 🍾

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Kannst ja in die [Documentation] kurz reinschreiben, dass eine FOR Loop auch abgebrochen werden kann. " can conditionally be exited"

Comment thread Examples/FOR_Loops/4_in_zip.robot Outdated
Log To Console ${first} ${last}
END

Combines two loops of different lengths
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Combines two lists of different lengths

@falk7
Copy link
Copy Markdown
Author

falk7 commented Feb 11, 2025

willst du den noch mergen?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants