About 50 results
Open links in new tab
  1. Recursion vs loops - Stack Overflow

    Mar 19, 2009 · In a loop, each iteration is a 'refreshed' scope, all of the variables from the previous iteration are deleted (variables for iteration i-1 can't be accessed from iteration i, because the …

  2. Iterating over a dictionary using a 'for' loop, getting keys

    Mar 16, 2017 · 1 If you want to loop over a dictionary and modify it in iteration (perhaps add/delete a key), in Python 2, it was possible by looping over my_dict.keys().

  3. When to use asyncio.get_running_loop() vs asyncio.get_event_loop()?

    15 In accordance with the official documentation, both the get_running_loop and get_event_loop are used to actually get an active loop, with the difference that the latter get_event_loop has more …

  4. Loop (for each) over an array in JavaScript - Stack Overflow

    Feb 17, 2012 · This question is similar to: Loop through an array in JavaScript. If you believe it’s different, please edit the question, make it clear how it’s different and/or how the answers on that …

  5. In detail, how does the 'for each' loop work in Java?

    } What would the equivalent for loop look like without using the for each syntax? People new to Java commonly encounter issues when trying to modify the original data using the new style foreach loop. …

  6. when to use while loop rather than for loop - Stack Overflow

    A for loop is just a special kind of while loop, which happens to deal with incrementing a variable. You can emulate a for loop with a while loop in any language. It's just syntactic sugar (except python …

  7. Loop through an array in JavaScript - Stack Overflow

    Jun 10, 2010 · 133 In JavaScript it's not advisable to loop through an Array with a for-in loop, but it's better to use a for loop such as:

  8. What is the difference between i++ & ++i in a for loop?

    The way for loop is processed is as follows 1 First, initialization is performed (i=0) 2 the check is performed (i < n) 3 the code in the loop is executed. 4 the value is incremented 5 Repeat steps 2 - 4 …

  9. python - How to emulate a do-while loop? - Stack Overflow

    # loop body here condition = test_loop_condition() # end of loop The key features of a do-while loop are that the loop body always executes at least once, and that the condition is evaluated at the bottom of …

  10. How do I reverse a list or loop over it backwards? - Stack Overflow

    How do I iterate over a list in reverse in Python? See also: How can I get a reversed copy of a list (avoid a separate statement when chaining a method after .reverse)?