do-loops

How to make a vbscript loop in loop go to start of code

天大地大妈咪最大 提交于 2020-06-08 13:50:22
问题 When running this code; varCheck=True Do While varCheck Pass=InputBox("Enter Password") Do If IsEmpty(pass) Then WScript.quit Exit Do End If If Pass = "123" Then varCheck=False Exit Do Else varCheck=True MsgBox("Wrong Password...Try Again") End If Loop Loop If the password is wrong then it doesn't restart to the top of the code, it just endlessly loops the "Wrong Password...Try Again" message box. How do I make it ask the password again? (p.s. I'm a newbie at coding so please explain yourself

Fortran; looping over file names with common attributes

不羁的心 提交于 2020-01-15 10:37:21
问题 I'm fairly new to Fortran and I am having trouble with my file names, I have a bunch of data in simuln#.res (where 1<#<20), I have multiple different directories with all the same simuln#.res names but they had different input parameters. The code looks like this: character(len=11) :: theFileA character(len=12) :: theFileB character(len=:), allocatable :: fileplace write(*,*) "the directory with the data sets, use quotations" read(*,*) fileplace fileLoop : do j=1,20 if (j .lt. 10) then write

Fortran; looping over file names with common attributes

烈酒焚心 提交于 2020-01-15 10:37:08
问题 I'm fairly new to Fortran and I am having trouble with my file names, I have a bunch of data in simuln#.res (where 1<#<20), I have multiple different directories with all the same simuln#.res names but they had different input parameters. The code looks like this: character(len=11) :: theFileA character(len=12) :: theFileB character(len=:), allocatable :: fileplace write(*,*) "the directory with the data sets, use quotations" read(*,*) fileplace fileLoop : do j=1,20 if (j .lt. 10) then write

Using “do” in Scheme

隐身守侯 提交于 2020-01-01 11:56:07
问题 What is the difference between CODE SNIPPET 1 and CODE SNIPPET 2? ;CODE SNIPPET 1 (define i 0) (do () ((= i 5)) ; Two sets of parentheses (display i) (set! i (+ i 1))) ;CODE SNIPPET 2 (define i 0) (do () (= i 5) ; One set of parentheses (display i) (set! i (+ i 1))) The first code snippet produces 01234 and the second produces 5. What is going on? What does the extra set of parentheses do? Also, I have seen [(= i 50)] used instead of ((= i 5)) . Is there a distinction? Thanks! 回答1: The

Do loop - random number is generating the same number twice and isn't adding it in a running total

做~自己de王妃 提交于 2019-12-25 09:18:38
问题 Hey guys thank you so much, in advance, for your help! I have a data step before the code below called "simulation_tracking3", that outputs something like: CDFx Allowed_Claims .06 120 .12 13 .15 1400 My hash table averages the Allowed_Claims based on a randomly generated value (from 0 to 1). For example, let's call this Process A, if Px = rand('Uniform',0,1) yields .09, I want it to average between the Allowed_Claims values where Px = .06 and Px = 0.12, which is (120+13)/2 The role of the

OpenMP and array summation with Fortran 90

三世轮回 提交于 2019-12-25 00:56:42
问题 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 ! sum over atoms j of i's atoms list j = LIST(nj) type2 = ATOMS(j) call get_ff_param(type1,type2,Aab,Bab,Cab,Dab) call distance_sqr2(i,j,r,VECT_R) call gettensor_rij(i,j,T) r = sqrt(r) if (r<coub_cutoff) then local_sum_real(id+1) = local_sum_real(id+1) + ( erfc

Value of Fortran DO loop index after the loop [duplicate]

拥有回忆 提交于 2019-12-24 00:09:47
问题 This question already has answers here : Why is the Fortran DO loop index larger than the upper bound after the loop? (2 answers) Closed 2 years ago . How do DO loops work exactly? Let's say you have the following loop: do i=1,10 ...code... end do write(*,*)I why is the printed I 11, and not 10? But when the loop stops due to an if(something) exit the I is as expected (for example i=7, exit because some other value reached it's limit). 回答1: The value of i goes to 11 before the do loop

In Scheme language, how to assign a variable counter in an inner do-loop connected with the outer do-loop?

对着背影说爱祢 提交于 2019-12-11 17:35:34
问题 I want to read 10 case files in Ansys Fluent and for each case file there are 10 data files to be read. Ansys Fluent uses Scheme programming language. I have to managed to get some answers to individual problems in the code here (Evaluating a floating point variable in Scheme language) and here (How to increase counter in a do-loop within Scheme language?), but when collecting the individual answers I realized that I need a new code for the counter which is used to read the data files through

How to increase counter in a do-loop within Scheme language?

倖福魔咒の 提交于 2019-12-11 14:15:30
问题 I want do a simple counter increase by one within a do-loop in Scheme language, but I'm not that familiar with the language and have tried many scripts without success. The code is going to be implemented in Ansys Fluent to read multiple case files: (define j 5) (Do ((i 10 (+ i 1))) ((>= i 20)) (ti-menu-load-string (format #f "/file/read-case \"C:/DataProcessing/Case~a-time~a-sec/test/Case~a-time~a-sec.cas\"" i j i j)) (set! j (+ j 1)) ) How to pass the new j value to the do-loop so that I