Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

While loops and try/except examples #3

Open
wants to merge 7 commits into
base: gh-pages
Choose a base branch
from

Conversation

falk7
Copy link

@falk7 falk7 commented May 23, 2023

No description provided.

FOR ${num} IN RANGE 10
Log To Console ${num}
END

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
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
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
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

Log To Console ${num}
Exit For Loop If ${num} == 0
Sleep 1sec
END
Log To Console 🎉🥳 HAPPY NEW YEAR !!! 🍾
Copy link
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
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"

Log To Console ${first} ${last}
END

Combines two loops of different lengths
Copy link
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

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