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
0
votes
1 answer

stopping a do until loop in Excel-vba

I created this macro to correct an error (to fill blank created by Feb 29 in non-leap years)i have been facing problem in stopping the Do Until loop. the macro does what it is supposed to do but it is not working as supposed to with Do Until…
Uttam Paudel
  • 5
  • 1
  • 3
0
votes
1 answer

OpenMP and array summation with Fortran 90

I'm trying to to compute pressure tensor of a crystal structure. To do so, I have to go throught all pair of particle like in the simplify code below do i=1, atom_number ! sum over atoms i type1 = ATOMS(i) do nj=POINT(i), POINT(i+1)-1…
Éric
  • 419
  • 5
  • 17
-1
votes
2 answers

Break and Continue in Java

// int i=0; // while(i<5){ // System.out.println(i); // System.out.println("Java is great."); // if (i==2){ // System.out.println("Ending the Loop."); // break; // // …
-1
votes
1 answer

Figuring out the pseudo code to hangman C++

#include #include int main() bool guessedWord; bool wantsToPlay; char answer; int errorCount = 0; char userGuess; char letter1 = '_', letter2 = '_', letter3 = '_', letter4 = '_', letter5 = '_', letter6 = '_'; // Letters to…
-1
votes
3 answers

How to use arrays in sas?

How to perform calculation using arrays in SAS? source file scholar Anne C A C D B E D D B A Vicky C C C E B E D B A Laurel D D C D B E D D B A Victor C A C D B E D D A D Dimple C A C D B E D D B A Godfrey B D C B D D D B B A Denny C D C B E E D B…
maxo
  • 7
  • 1
  • 5
-1
votes
1 answer

SAS code - sum of last N rows for every row

I have a dataset like this for each…
Deniz
  • 53
  • 7
-1
votes
1 answer

Using Excel VBA Range.Find to find first and last addresses of a range of congruent data containing similar values and break a Do Loop?

I have been struggling to get a Do/While loop using Range.Find and Range.FindNext methods to break out of an infinite loop. I have researched all of this and found the tons of duplicate questions asking generically "how do I stop the infinite…
k1dfr0std
  • 379
  • 1
  • 15
-1
votes
4 answers

create 1000, 8-character random ID's, all unique and display in a text box

enter image description hereWrite a program to display 1000 8-character random user IDs in a text box after you click a button. Make sure the program verifies that none of the IDs are identical. Each userid should include a mixture of alphabetic…
-1
votes
1 answer

Setting final value to zero makes the program not count or output, but setting to the lowest value does

This is practice for a separate larger program, just a little console output showing how many of certain values are used. For some reason if I set the final while num value to zero, it won't output anything in the console. If I set it to 20 it will…
Brian
  • 27
  • 7
-1
votes
1 answer

how to use do and while loop in haskell

I tried to use an addition and print every step, but it doesn't work, can someone help me out please? addition x = x+1 acc_addition xs = do print xs let result = addition xs if result == 5 …
Andy Tsao
  • 33
  • 2
-1
votes
3 answers

Going backwards select the first non negative number SAS

I have a dataset that looks similar to the below: ID COL70 COL71 COL72 COL73 COL74 1 4 3 2 -998 . 2 2 0 2 1 -998 3 1 -998 -998 . . 4 3 4 -998 -998 -998 What I want to do is have a…
MLPNPC
  • 454
  • 5
  • 18
-1
votes
1 answer

Creating a macro to subset a monthly data into smaller datasets based on date in SAS

I'm working on a large dataset which have data for a whole month with around 42 variables, and I want to create separate datasets for every day of the month. How can I create a macro which will do it properly? The date variable is trans_date and…
Jay
  • 1
  • 1
-1
votes
1 answer

Can anyone please explain this piece of code?

do{ var string1=prompt("Enter text"); } while(!string1||!/^[a-zA-Z\s]*$/.test(string1)); Can someone please explain to me the condition inside while in detail?
Badrul
  • 1,582
  • 4
  • 16
  • 27
-1
votes
3 answers

Why won't my program loop correctly?

I'm new to programming and I'm making a guessing game where the program randomly generates a number between 1 and 10, the user then is asked to guess what the number is, the user should be able to keep guessing until he guesses correctly and the…
-1
votes
2 answers

Creating a while loop that returns (y/n) statement in C++

So my issue is that I am trying to create a tax program that gets a user input for income, status, and then prints out the results. I can get that all done with no errors. Once I try to get it inside of a while loop that will prompt the user "Do you…
Shirojin
  • 11
  • 3