Questions tagged as 'for'

1
answer

How do I return the sum total of the words repeated, within all div?

To illustrate the degree of difficulty, I put 3 div and within them identical words, put it on purpose to add to its duplication. <div> <div> <div> Diego Ademir Diego Maicon Diego...
asked by 23.03.2017 / 18:29
1
answer

Problem with loop for in JavaScript

I want the loop below to show all even numbers that are less than or equal to it, but I can only get it to show the last number. If I type 40 and it returns only 2. <div class="calculo"> <input type="number" id="num1" placeholde...
asked by 26.03.2018 / 06:59
1
answer

Creating Paging in Strings with Javascript

I'm creating a code for paging the contents of a new String(); with Javascript, warning in advance, which is a run-time paging compared to a pagination performed by ASP or PHP. It consists of listing a certain number of rows from new S...
asked by 22.05.2016 / 21:12
0
answers

Is it possible to optimize this code?

I asked a question here and they sent me a suggestion of a code that does a search on the contents of all .bat files in a directory using as criteria, names that are in a .txt file. set "File2Read=falhou.txt" set "File3Read=call.txt" If No...
asked by 27.06.2018 / 15:01
1
answer

Is it possible to convert this for loop to a function of the apply family?

df_loop <- data.frame(data1, data2, data3, 0) for (i in 4:nrow(df_loop[1])) { tmp_1 = df_loop[i,1] tmp_2 = df_loop[i,2] tmp_2_lag3 = df_loop[i-3,2] tmp_3 = df_loop[i,3] if (!is.na(tmp_2_lag3)) { if((tmp_1 >...
asked by 06.06.2017 / 09:23
2
answers

MATLAB - Data is lost when closing the FOR loop

I'm having trouble with a loopback that counts the white pixels of a piece of an image and stores the position x and y of the piece and the total of white pixels. When I print the values inside the loop it works, but immediately after the loop t...
asked by 27.06.2017 / 18:10
0
answers

Why does it only work as expected the second time?

I have this function: for (var i in chars) { chars[i].walk(); for (var j in chars) { if (i != j) { collision(chars[i], chars[j]); action(chars[i], chars[j]); } }...
asked by 02.08.2017 / 00:30
1
answer

How to do auto-complete / incremental script

There was a need to create a text field that might be given city names, however, if you completed the word in the field when you started the first digits. I need some idea, function with Arrays literals, something like this: <...
asked by 17.04.2016 / 00:01
3
answers

Execution or not of the increment in loops for [closed]

Code 1 : var x = 1; for( ; x<6 ; x+=2 ){ x=x*x; } console.log(x); In the above code even if the condition is false the part that increments is executed the last time. Code 2: var x = 0; for( ;...
asked by 19.10.2017 / 18:54
3
answers

Python - Cycle is an alternative to the while loop

Generic considerations: I am currently programming in python ; I have a relatively simple level code; The code contains an instruction loop of type while loop ; I would like to know if there is a way to run the code specif...
asked by 12.05.2018 / 12:48