Skip to main content
The 2024 Developer Survey results are live! See the results

Questions tagged [for-loop]

A for loop is a control structure used by many programming languages to iterate over a range. It is a way of repeating statements a number of times until the loop ends. Depending on the language this may be over a range of integers, iterators, etc.

0 votes
2 answers
29 views

Progress bar in vba

I'm working with a macro that takes a long time to execute (>1 min) and I want to improve it by adding a progressbar. I've followed multiple tutorials that all say to create a userform, add an ...
Brocas Sylvain's user avatar
9 votes
1 answer
630 views

Why is JavaScript executing callbacks in a for-loop so fast the first time?

The following code with callback argument runs faster in the first loop. const fn = (length, label, callback) => { console.time(label); for (let i = 0; i < length; i++) { callback &...
Matsuzaka's user avatar
0 votes
3 answers
47 views

Finding the Sum of multiple arrays nested in one array

I'm trying to find the sum total of the arrays nested inside of the parent array. and push the sums into their own array. only using the for loop. I could be way off here, I can't seem to get past how ...
Justin Hawkins's user avatar
0 votes
1 answer
35 views

Create a new column based on other columns for time series data in pandas

I have the following pandas dataframe with columns May, June, and July. Month June July Aug June a d g July b e h Aug c f i I want to create a several new columns with a 1 month forecast, 2 month ...
kmm2204's user avatar
-2 votes
0 answers
26 views

How do I consolidate code to repeat the same process for a number of different cells, is this where arrays come in? [closed]

I have a trigger cell which contains a value I am iterating between 0 and 170 degrees in 5 degree increments. As the value increases a number of different cells change throughout the spreadsheet which ...
Josh's user avatar
  • 9
1 vote
2 answers
67 views

How do I get my For Next loop to actually loop

I have a loop, however it only finds the first iteration and doesn't loop onto the next iteration. I've set up a loop. So far, it opens a worksheet called Names, counts rows containing IMP and EXP and ...
One foot in the Grave's user avatar
0 votes
1 answer
56 views

Java's advanced for loop not inputting captured values from nextInt properly

After initializing an array and using the For-Each Loop to capture 2 input values and update in the array, printing the values out results only in the last integer input showing, a zero. int[] ...
Ken Kiarie's user avatar
0 votes
1 answer
96 views

Adding elements into a char array

I've been trying to make a function in C that takes a string as the input and then prints out a version of that string that only contains alpha characters. #include <string.h> #include <ctype....
Lushana Elie's user avatar
1 vote
0 answers
39 views

Julia - Reduce allocation in nested for loops

I have a function that calculates the expectation and covariance of random variables on a grid with dimensions (nx, ny, nz). The variables y and z are Markovian, with Qy and Qz being their Markov ...
Ethan's user avatar
  • 11
-2 votes
1 answer
61 views

How can I run If statements on every sheet that contains specific text using VBA?

I am trying to create a macro that will run If statements on every sheet with "(M)" at the end. I just need the macro to check cell "G8" in every worksheet with "(M)" at ...
Nick Speake's user avatar
-2 votes
1 answer
19 views

Google Apps Script - Sum Per Row in a Group of Columns

Data for Aug 1 Data for Aug 2 Data for Aug 3 Desired Output 1 5 8 14 2 4 9 15 3 3 10 ...
Dorcas Domingo's user avatar
-1 votes
1 answer
56 views

Terraform Nested or For Loops to provision Azure Resources

So I have a Terraform locals.tf file which has the below content to represent a set of environments I intend to deploy to: locals { environments = [ "sandbox", "test", ...
hitman126's user avatar
  • 861
-2 votes
1 answer
33 views

Selecting items with special features from a list and transferring them to a new list [duplicate]

I'm new to programming and I'm learning Python, so my question might seem clumsily: If we have a list (for example, a list of different names) and we want the names that end with a special letter (for ...
yasaman's user avatar
  • 11
0 votes
0 answers
11 views

Run Wilcox.tests across two years for two different places, with multiple subgroups

I want to run wilcox.test to compare Yr1 and Yr2 for each Gear within each Village. e.g. Village A Gr1 - Yr1 vs Yr2 Village A Gr2 - Yr1 vs Yr2 Village B Gr1 - Yr1 vs Yr2 My dataframe looks like: # DF1 ...
Fishydata's user avatar
0 votes
0 answers
59 views

Windows command using tokens & delimiters works from the command line but not in a batch file. EVEN WHEN the extra % is added [closed]

When I have the appropriate window open the following command works from the command line: FOR /F "tokens=1 delims=," %A in ('tasklist /FI "WINDOWTITLE EQ Backup - C:\Backup.bat\"&...
Ryan McArthur's user avatar

15 30 50 per page
1
2 3 4 5
4804