Most voted "loop" questions
Loops are a type of flow control structure in programming in which a series of statements can be run repeatedly until some condition is satisfied.
Learn more…671 questions
Sort by count of
-
1
votes1
answer160
viewsInfinite loop with data stream in PHP
I have the following code below: <?php $Start = microtime(true); $Code = <<<'Code' <?php for($i = 0; $i < 300; $i++){ echo '.'; } Code; include 'data://text/plain,'.$Code; echo…
-
1
votes0
answers108
viewsProblems generating JSON with JAVA
I’m having trouble generating this json { "receita": [{ "specialtys": [{ "date": "27/01/2016 00:00:00", "itemSpecialtys": [{ "specialtyId": 1, "specialtyName": "Tabelionato de Notas", "receitas": [{…
-
1
votes1
answer403
viewsHow to 'Loop' in Multi-dimensional Array in Bash?
Situation: I need to create a multi-dimensional array script. Example: Table 1 >> Campos id and name Table 2 >> Campos id and telephone Current script: #!/bin/bash declare -A arr…
-
1
votes2
answers215
viewsInsert a dot in the penultimate variable item
I have a variable with the value "14013" and I’m trying to insert a point to have the following value "140.13" in my loop. for (var i in teste) { for (var j in (teste2[teste[i]])) { valorFinal[j] =…
-
1
votes2
answers63
viewsLooping for as a looping parameter while
Whereas the list cont would have the values: cont = ['t','f','f','t','f'] It would be possible something like this: while(for cont in cont == 'f'): pass…
-
1
votes1
answer311
viewsVariable not defined in Python for-loop
I have a problem in a code that should read 4 values using raw.input().split() and then a for-loop to turn such values into float. The interpreter returns to me: "name 'val' is not defined" Follows…
-
1
votes2
answers512
views -
1
votes1
answer314
viewsHow to loop within a query?
I have a list of phone numbers and their operators. This list is presented in icon format and when the mouse on top appears the number related to the operator in the format of tooltip. But the same…
-
1
votes2
answers159
viewsModular programming in Java, called methods
He needed help to put the smaller and larger method to be "heard" in the main method. The logic of the program is to show the user what is the highest and lowest value of a vector. CODE: import…
-
1
votes2
answers68
viewsHow to rewrite the initial array and remove items by the ID in the view with Smarty?
I’m using the View rendering library with Smarty. In my view, I have an output with the product information array inside a foreach: {assign var='remove_products' [712, 716, 717, 718, 719, 720, 745,…
-
1
votes3
answers11849
viewsRestart application in Python
How to restart my program with Python? cpf = input('Digite os nove primeiros dígitos do CPF: ') if len(cpf) != 9: # Aqui deve reniciar a aplicação.
-
1
votes1
answer647
viewsCan someone explain to me what is a Gothic Moon tie?
I already know the bonds while,repeat and for,but when I was seeing the types of loops, for generic" . The text was in English.
-
1
votes3
answers11136
viewsStore data inside a Python loop array
Good afternoon, you guys. I’ve been learning a lot of C and C++, and the python part too. It confuses me a lot the syntaxes sometimes, because I often think of C and I get confused in python. In the…
-
1
votes1
answer139
viewsfor em onload Javascript
Why I don’t get to call the function showSeatStatus(i);? window.onload = function() { //Conecta os eventos de imagem de poltrona for (var i = 0; i < tamanhoMatriz; i++) {…
-
1
votes2
answers204
viewsPrintar 2 interlaced strings
How do I print 2 interlaced strings (I don’t know if that’s what it’s called)? For example: string1='aovces' string2='m o' so that in the print "I love you guys" in the case, interspersing each…
-
1
votes0
answers70
viewsAbout the second Nightmare video, my character doesn’t get animated on a loop
My question is about character animation. The tutorial I followed is from "Playing with Nils" The video is "Unity3d - How to create character, animation and movement - Nightmare - Unity Training Day…
loopasked 8 years, 5 months ago Kleiton Diones 31 -
1
votes1
answer6005
viewsTransform all elements of a list into floats
That’s the code I wrote. n_alunos=input('') x=0 idades=[] alturas=[] while x != n_alunos: x+=1 n=raw_input('') a=n.split(" ") idades.append(a[0]) alturas.append(a[1]) How to transform the elements…
-
1
votes2
answers630
viewsHow can I create sequence and math series functions in python?
How can I get the interpreter to understand what the previous value of a mathematical function is, for example: "Xn = 3.7(Xn-1)" where "n-1" means the result of the previous loop operation. Kind of…
-
1
votes1
answer219
viewsDictionary and repeating structure
The problem asks me to count the size of holes in the text Exp: A, D, R, O, P has only one hole, and B has two I made the following code: qnt = int(input()) cont = 0 l = [] for i in range(qnt): txt…
-
1
votes1
answer100
viewsError while using while to generate barcode
First: I’m using the function below and am implementing a chile. Reason: need to generate several codes, example: 1 2 3 4 5 .... 98 99 100,follows code: <?php $i = 1; while ($i <= 100) {…
-
1
votes1
answer146
viewsWhy does it loop infinitely in the println?
Build a program that is able to average all entire or actual arguments received from the keyboard and print them. Invalid arguments should be disregarded (Print a message for each invalid value. ),…
-
1
votes2
answers75
viewsIs there an error in these command lines?
I am comparing documents across Bash’s command lines and using a loop command. However, an error occurs with the results: ./anibatch.sh: line 38: ./ANIcalculator: No such file or directory…
-
1
votes2
answers68
viewsIncrement in For loop
I need a count that goes from 1 to 24, but in that order: 1,9,17,2,10,18,3,11,19,4,12,20,5,13,21,6,14,22,7,15,23,8,16,24 I did so, but I wanted something more "elegant". for($x=1;$x<9;$x++){ echo…
-
1
votes2
answers86
viewsInserting a string into a list of ints
I have the following rule: Create a function that receives a list of integers, and replaces the items as below: if Multiples of 3 = 'Fizz' multiples of 5 = 'Buzz' multiples of 3 and 5 = 'Fizzbuzz' I…
-
1
votes0
answers47
viewsHow do I change the wordpress loop category via ajax
I will have a select with 3 categories, every time I change the value of select it changes the result of lop Example: <select> <option value="Noticias">Noticias</option> <option…
-
1
votes1
answer75
viewsQuestions about Javascript looping
I noticed it’s used a lot var i and when is for/in and var x, why use these letters? I can use words in their place and it will work normally. I can put a for into another? That would cause some…
-
1
votes1
answer765
viewstraverse array and insert break line jquery
This application does not work as expected. var storeElements = []; var store = []; $('body').on('click', 'a.add_aluno', function () { var aside = $(this).parent().parent().children('aside');…
-
1
votes1
answer38
viewsI can’t run the jquerry loop
I need to create a loop so I can feed it a graphic. while($(".previsto").eq(0).text(),){} I need to take these values eq(0), eq(1), eq(2)... $(".previsto").eq(0).text(), $(".previsto").eq(1).text(),…
-
1
votes1
answer34
viewsMake cumulative value in loop
var previsto = []; for(var i = 0; i < $(".previsto").length ; i++) { previsto[i] = $(".previsto").eq(i).text(); } I need to take the next amount adding up the previous one, to have a buildup.…
-
1
votes0
answers47
viewsJavascript copying content from another DIV that is not for copying
Can someone please help me? The script I did is to turn the curriculum matrix that is in a ul into separate columns, but it’s picking up the curriculum matrix of other courses. I remember how to…
-
1
votes1
answer28
viewsReturns value of an array dynamically
I have an array $teste = [1,2,3,4]; <Input type="text" value ="teste[0]" /> //retorna "1" How I could bring all array values into inputs?
-
1
votes1
answer242
viewsHow to return to the beginning of a C#Array
I have to develop a code where he does the Cesar Cipher encryption, the characters I should use should be in this sequence; A~Z,(blank space),0~9. I’ve developed most of the code, only I ran into a…
-
1
votes2
answers1666
viewsManipulate all images from a directory without having to access
The Script below, is in charge of showing a sequence of images at a certain amount rate (one), so it is necessary to define a number of images. Check out: Code <html> <body>…
-
1
votes1
answer78
viewsList append on for loop - Swift 3 / Xcode 8
I’m having a problem Adding items to a list Inside the 'for' loop, Where all items in the list are repeated with the last value entered. Here is my Nsmanagedobject list var listCursosNovos: [Cursos]…
-
1
votes2
answers112
viewswant to read more than 1 file . txt in C
I wanted to create several files. txt and I did it through a loop, and I got it. But I group the only way I can read all the files is by making another loop, example: makes a looping of 3 passwords,…
-
1
votes1
answer692
views -
1
votes1
answer206
viewsCreating a loop with php and mysql
I need a help to create a function in PHP. I have a table in the bank at Mysql, where in a column I want to vary the numbering from 1 to 4 per record. For this I have a form where the client fills…
-
1
votes2
answers327
viewsHow many times will the x variable be created at the end of the loop? Why?
In the following loop, how many times the variable x will be created at the end of loop? Why? for (int i = 0; < 10; i++) { double x = i + 10; System.out.println(x); }…
-
1
votes2
answers166
viewshelp with indentation that is generating error in python 3.6
I’m doing a webcrawler I’m having the following problem. I had to do a separate program to print out how many candidates passed each course. Only that the last line is not running, and it would make…
-
1
votes3
answers181
viewsDifference between two codes
Code 1, if variable num is 1 or 2, for example when the conv() is called again and I choose option 3 to exit then wheel the print I hope I have been helpful (: but the program does not close, only…
-
1
votes1
answer2063
viewsHow to find higher value Chained List C?
I’m having a hard time solving an exercise in C, I never programmed it and I got C in the first semester, you can help? I need to draw 3 integer values between 0 and 200 in the main function. If the…
-
1
votes2
answers912
viewsHow to display an upper triangular matrix?
Write a program that prints a 10x10 matrix that is triangular higher, that is, the elements below the main diagonal are null (or zero). Until then I managed to do this: for linha in range(10): for…
-
1
votes1
answer26
viewsHow can I remove every link that points to a video after the video ends?
I have this div below, namely with id and having within it the elements p followed a(anchor): var vid = document.getElementById('player'); var link =…
-
1
votes2
answers212
viewsHow to prevent my site from falling, when running a "heavy" script?
I have a script that goes through a directory looking for video files in it and then I use the shell_exec with the ffmpeg to convert the same, the problem is that my site is falling while running…
-
1
votes2
answers313
viewsButton locked in while
My program has a loop, created with the command while. I start the loop with the start button. However, I can’t do anything else in the program while the while is spinning. I wanted to put a button…
-
1
votes1
answer112
viewsHow to imitate "until... you do" command with python?
How can I make a counter regressing with python? I tried so: count = int(10) while True: print("Eu conto", count) count = int(count -1) if count = 0: break but it seems that it does not accept the…
-
1
votes1
answer222
viewsHow to perform an action when finishing each() Jquery
I’m using the function each() of Jquery would like to know if there is a mechanism so that I can perform a function after the each(). As soon as I finish mine each(), I can do something else, but it…
-
1
votes1
answer39
viewsError in meter division
Why is my code performing the wrong average division because of the variable contador? int numero,contador, soma; float media; soma = 0; for (contador = 1; contador <= 3; contador++) {…
-
1
votes2
answers374
viewsCreate loop in templates with php
I’m having trouble creating an algorithm to implement the use of loops in a class of template simple. I have my class below, it gets an HTML file, looks for strings specifies that are in this file…
-
1
votes2
answers48
views