Questions tagged [do-loops]

a 'do' loop is a specific type of iteration used to run code repeatedly based on the evaluation of a boolean statement or variable.

do (while) loops in Java: https://docs.oracle.com/javase/tutorial/java/nutsandbolts/while.html

do loops in Fortran: https://en.wikibooks.org/wiki/Fortran/Fortran_control#Loops

do loops in Scheme: https://schemers.org/Documents/Standards/R5RS/HTML/

389 questions
1
vote
1 answer

Count Virtual Desktops then delete more than 2

Preface: I have not been formally trained on how to code. I have kind of winged it and done simple thing like registry entries via powershell. I have a small script I am trying to run that will test to see how many Virtual Desktops I have running…
Twiggo
  • 15
  • 4
1
vote
1 answer

Adding information to file by ID in column in Fortran

I am trying to combine multiple files in Fortran. The files all have one column in common ("einst") The main file has over 100.000 lines but the other files contain extra info about some of the IDs in the main file. I want to merge the smaller files…
Thordis
  • 87
  • 1
  • 11
1
vote
0 answers

stucked do loop in fortran

i just make easy equation(gaussian-plume eq.) the goal is Concentration values based on x, y, z distribution but the loop is stucked at just first step what's the problem? here's my code PROGRAM plume IMPLICIT NONE REAL,PARAMETER ::…
won
  • 21
  • 2
1
vote
1 answer

How to plot on the same graph with for cycles with Gnuplot?

I want to fit multiple data set and plot the result on the same graph, what I' am doing is: do for [i=2:500]{ fit f(x) "myData" using 1:i via a,b plot f(x) } The fit works fine, the big problem is that this code produce a different plot at each…
RIXS
  • 115
  • 5
1
vote
5 answers

Are there any languages that have a do-until loop?

Is there any programming language that has a do-until loop? Example: do { } until (); which is basically equivalent to: do { } while (); NOTE: I'm looking for post-test loops.
Jake Petroules
  • 23,472
  • 35
  • 144
  • 225
1
vote
3 answers

Concatenating a variable dynamically in SAS

I want to create a variable that resolves to the character before a specified character (*) in a string. However I am asking myself now if this specified character appears several times in a string (like it is in the example below), how to retrieve…
Kermit
  • 3,112
  • 2
  • 10
  • 34
1
vote
1 answer

How to loop based on cell value?

This code is meant to copy and paste x number of times based on a cell value. It bugs out and doesn't stop the loop. When I step into it, it runs once and stops. "O7" is how many times I would like to copy and paste. Sub WorksheetLoop() Dim NS As…
Scott P
  • 29
  • 8
1
vote
2 answers

Going back by one day with date in string format

I am trying to execute a code iteratively rather than manually. What I would like to do is as follows: I add as an input a date (string format) start=input("Start: mm/dd/yyyy ") and I set this date equal to the end date: end=start then I run some…
still_learning
  • 776
  • 9
  • 32
1
vote
1 answer

First loop through columns and then loop through through rows

I want to loop first through columns and then through rows. data test ; input cat $ cat3 cat4 cat5 cat6 cat7 cat8 num_rat ; cards; cat3 0 -1.78 -2.68 -3.06 -3.4 -3.83 1885 cat4 0 2.12 -2.15 -2.63 -2.94 -3.34 3151 …
Jass
  • 11
  • 2
1
vote
1 answer

While loop not executing code in correct order in C

i am new to learning C language . I have shifted from C++ and was implementing the while and do while loop The following is a snippet from my code . This works fine in C++ but in C after executing while loop once it executes scanf first and then…
aryaman
  • 27
  • 4
1
vote
1 answer

Why does the space is required before %c in order to make the code work?

THAT'S REALLY INTERESTING wrong code #include int main( ) { char another; int num; do { printf("Enter a number: "); scanf("%d", &num); printf("\nWant to enter another number y/n "); …
1
vote
2 answers

How to calculate the factorial of a number entered by user in Javascript, using, do-loop, while-loop?

Quick follow-up question on my previous question. I'd like to add the code to the following to calculate the factorial of a number entered by user in Javascript. Sum of Numbers