Skip to main content

Questions tagged [loops]

Loops are a type of control flow structure in programming in which a series of statements may be executed repeatedly until some condition is met.

-3 votes
0 answers
17 views

Is it faster two use two separate loops to iterate over two arrays? [closed]

Say I have an existing array A, and I want to independently map these values to two empty arrays (B & C) with two different pure functions. Would you expect it to be faster to run two seperate ...
Harvey Williams's user avatar
1 vote
1 answer
43 views

Loop models multiple times

I am trying to run the following code multiple times with different values for the 'aux' object. time <- seq(0, 30, 1) stock <- c(sK=0, sF=1) aux <- c(aH=0.4, aRel=0.5, aRes=0.5, aS=0.8) ...
user11806155's user avatar
-1 votes
0 answers
29 views

Why doesn't .rumble() make my controller vibrate as specified?

My Python script that activates vibration of a PlayStation 4 controller in a for loop should terminate if the controller is disconnected. However, it does not vibrate as specified when I pass the ...
Ezekiel Obuobisa's user avatar
1 vote
1 answer
23 views

Pass element form character vector in loop to function and use in assign

I have a function that chooses, reads and formats Excel reports from Workday, and produces data.frames. I've simplified for purposes of begging for your help. :-) In the function, I pass a parameter ...
David Weisser's user avatar
0 votes
1 answer
11 views

Creating a Repeating/Looped Table in Cognos

I need to create a table of lat/lon coordinates with repeating values, in order to calculate distances between all locations. In the DB I have the following fields to use: Location Code Latitude ...
Andrew Moseley's user avatar
0 votes
0 answers
33 views

How to calculate the Relative Strength Index (RSI) through record iterations in pandas dataframe

I have created a pandas dataframe as follows: import pandas as pd import numpy as np ds = { 'trend' : [1,1,1,1,2,2,3,3,3,3,3,3,4,4,4,4,4], 'price' : [23,43,56,21,43,55,54,32,9,12,11,12,23,3,2,1,1]...
Giampaolo Levorato's user avatar
-2 votes
1 answer
56 views

Python input validation won't end

I am trying to make sure a user only chooses an option between 0 and 2. If they don't choose that, I want them to be able to try again. Nothing seems to be an infinite loop, but the program will never ...
Michael K.'s user avatar
0 votes
1 answer
63 views

Loop Splitting Decreases Performance in Intel Fortran

Compiler: Intel Fortran 2024 Operating System: Windows 11 I'm pretty new to Fortran, working on a Fortran project and found out that the loop splitting will decrease the efficiency dramatically. For ...
Lamires Asu's user avatar
-3 votes
0 answers
21 views

QT6 multi butons change parameters in loop [duplicate]

I apologize for the bad English (translator), I am looking for a solution for a dynamic name for the buttons so that I can go through all the buttons in a cycle and then name them individually ...
Zweistein's user avatar
0 votes
0 answers
40 views

Breaking Loops in Python

I have a long, I2C python program for a I2C MUX Board that I am making. I have 4 MUXs, in my program I am using a while loop for each one. Within the while loops, I have this structure (to make it ...
Beau Raley's user avatar
-2 votes
0 answers
73 views

what are the major differences between case1 and case2? [closed]

//case 1: main() { int i=1; while(1) { // your text printf("%d \n",i); ++i; // your text } //case 2: main() { int i=1; ...
Arpit Upadhyay's user avatar
0 votes
1 answer
50 views

How to loop through an array?

How do I loop through an array? The idea is to go to the Names worksheet, Where I have a list of users Initials and names in a list. Create 2 arrays that record the initial and name of each person. ...
One foot in the Grave's user avatar
0 votes
2 answers
67 views

Bash loop on two sets of files simultaneously

I have two sets of files in the same directory : 1.bam 2.bam 3.bam and 1.txt 2.txt 3.txt I need to run a command where 1.bam and 1.txt are interpreted together, and so on.. I tried looping through ...
pedro's user avatar
  • 443
-1 votes
2 answers
33 views

Extracting values from array and adding them to new elements

I've got some code which loops through an array of products, it records new categories found and also how many times a category is found: const categoriesFound = (catArray) => { let categories = {...
Chobbit's user avatar
  • 493
-1 votes
3 answers
40 views

How to run map() after fetch has completed React

I'm trying to fetch data and then get my React App to map through the data to render each product on the page. However it fails to find the data to perform the .map() and I assume that's because the ...
Chobbit's user avatar
  • 493

15 30 50 per page
1
2 3 4 5
6438