Jump to content
Sign in to follow this  
Uten

Code quiz

Recommended Posts

Uten

Answer the pol without cheating please..;)

Will this piece of code execute one or more times? (Don't cheat by testing)

Local $c
Do
    $c += 1
    ConsoleWrite("Run nr " & $c & @crlf)
    sleep(1000)
Until (NOT True) OR $c=3

EDIT: uh, what happened to the pol? Cant get it going. So any explanations to the behavior?

Edited by Uten

Share this post


Link to post
Share on other sites
Nevin

I'm rusty on these things with AutoIt but wouldn't "NOT True" read as "not equal to 1"?

I guess it depends on the language. Then it would run twice.

Share this post


Link to post
Share on other sites
SmOke_N

Answer the pol without cheating please..;)

Will this piece of code execute one or more times? (Don't cheat by testing)

Local $c
Do
    $c += 1
    ConsoleWrite("Run nr " & $c & @crlf)
    sleep(1000)
Until (NOT True) OR $c=3

EDIT: uh, what happened to the pol? Cant get it going. So any explanations to the behavior?

It will run until $c equals 3, so 3 loops, even though you didn't give the initialization variable $c a value, it still equals zero, so it would actually loop 3 times.

Edit:

I should say, it will run through the loop 3 times, it actually should only loop twice.

Edited by SmOke_N

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Share this post


Link to post
Share on other sites
monoceres

Heh, fun idea ;)

How many times will this loop iterate?

Local $a=0
Do
    $a+=1
Until $a=10 And Assign("a",$a+1)

Broken link? PM me and I'll send you the file!

Share this post


Link to post
Share on other sites
youknowwho4eva

Without running it I would say that would error, just tested, no error. I just assumed it wouldn't like the "and Assign".


Giggity

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.