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

How to simplify complex nested do-loops?

I have very tedious task to optimize some ancient Fortran77 code. Honestly, I don't know fortran at all. I know how loops works and how to multiply matrices. I also know that this loop can be optimized to few 3-4 nested loops: do i = 1, nocca …
-2
votes
1 answer

Compare two lines in Fortran

I have a data file with 2 columns. Let's say: column 1 (8,8,8,6,9), reading it as a. column 2 (3,4,5,6,7), reading it as b. I want to write a code checking if a(i)=a(i+1) then b=0. So result should be column 1 as a: (8,8,8,6,7), column 2 as b should…
-2
votes
1 answer

Loop without Do error within Select Case statement

When running this code I get a error that is "loop without do". I want if "case vbno" is selected then it returns to the original input box. If it the user selects "case vbyes" I want it to highlight then cell then loop back to do and return to…
Mitch
  • 1
  • 1
-2
votes
1 answer

Proc Sql Do Loop in SAS

For an assignment I am asked to create a do loop in Proc Sql statement. My program is not recognizing the m1sales and m2sales. Here are the data sets and the macros that I had to create. The First macro is to set allow people to set the qtr to a…
Marvin Bahr
  • 135
  • 1
  • 2
  • 11
-2
votes
1 answer

SAS do loop macro

I'm trying to get this macro with a do loop to work. Seems straightforward by it doesn't populate the new fields with anything. Please any help is appreciated. An array doesn't seem work as my data is all in columns. Thanks! %macro labs; data…
-2
votes
2 answers

How to find the maximum and minimum value from a text file in Fortran

PROGRAM maxmin IMPLICIT NONE INTEGER :: openStatus, ioStatus INTEGER :: counter, counter2, counter3 INTEGER :: numberOfInts INTEGER :: int_val, max_int, min_int OPEN (UNIT=12,…
Master
  • 59
  • 1
  • 2
  • 10
-2
votes
1 answer

Summation issues with function input to do summation operations

I have this program that I wrote trying to test out if I could define a user inputted function then get Fortran to do summation with it. This is what I did. program test real :: a,b,n,k,sum integer, intent(out) :: func print *, 'what are the…
p.patel
  • 11
-2
votes
2 answers

Nested do while loop

so I've been trying to do a menu with more sub menus. The main menu is a do while loop so if the user tried to enter an irrelevant input, it will let him re-enter. I was wondering if I can do so the same thing with the sub menus but the sub menu…
H. Malkawi
  • 33
  • 7
-2
votes
1 answer

SAS: do loop help: variable =1 from start of by group until marker =1

In SAS, I have data that is sorted by time. For the first n minutes, a marker variable is marked 0 then changes to 1. This occurs within a 'by' variable. I want to create a new variable that =1 for each minute from the start of the 'by' group…
-2
votes
4 answers

How many conditions can be included in 'while' loop and how?

I want to apply more than one while loop so it can do the calculations below but within the given range. eg. p_fifties-= fifties must calc while it is between 0 < x < 10. So when it's more than 10 it must do the next calculation. I was wondering if…
Kadir
  • 63
  • 1
  • 13
-2
votes
3 answers

PHP do loop doesnt exit

I have made a small script, which should redirect to one of 8 pages by random. Before picking the page I ask the database, to narrow the choices. (So that every page is picked on the same seed) . Unfortunatly I got stuck in the do-while loop. Here…
jorop
  • 483
  • 4
  • 4
-3
votes
1 answer

PROC SQL SAS PROGRAMMING

I have the following dataset: Name Address Bank_Account Ph_NO IP_Address Chargeoff AJ 12 ABC Street 1234 369 12.12.34 0 CK 12 ABC Street 1234 450 12.12.34 1 DN 15 JMP Street …
-3
votes
2 answers

How to echo full list of rows in php mysql using while loops but outside the loop

Hello please help me is this code this code only show me last row of loop not full. $sql = mysql_query("SELECT hash FROM users"); while($row=mysql_fetch_assoc($sql)) { $url = $row["hash"]."
Ammad Khalid
  • 176
  • 2
  • 9
-8
votes
3 answers

How can i make patterns using do while loops in C#

I'm kind of a newbie when it comes to looping. :( please help me. Question: Using a do loop, draw the following pattern: * ** *** **** *****
1 2 3
25
26