Questions tagged as 'loop'

1
answer

How does for (?;) work?

It's probably duplicated, but I did not find it here in SOpt, and I do not know how to search on Google. How does the for loop work in this syntax? for(;;) { //... }     
asked by 20.10.2017 / 18:29
2
answers

How do I exit a loop by entering a specific value?

I need to make a program that multiplies the numbers entered by the user, and when it says 0 (zero), the program shows the multiplication of the numbers entered. However, I am in doubt as to how I will do this without clearing my multiplication....
asked by 17.10.2015 / 21:36
4
answers

Which way can I use regular expression to capture only some attributes of links

I need basic example (s) of how I can compose a tiny script to just get the contents of the attribute href . I will simplify the explanation in two groups, they are: A and B In Group A we have the respective links started...
asked by 14.12.2017 / 06:44
1
answer

Invert while results

Is there a function in PHP that allows me to reverse the order of results of a while ? For example, I have the following code that checks for a URL. <?php function url_exists($url) { $ch = curl_init($url); curl_setopt($ch,...
asked by 14.01.2015 / 16:46
1
answer

Is it possible to use the "break" argument on a "switch" to break a loop?

When I want to break a loop of a for , while or foreach I always use break; within a if with the following structure: $teste = array(1,2,3,4,5); foreach($teste as $t){ if($t == 3){ echo "Terminando loop a...
asked by 20.04.2015 / 23:20
3
answers

How to traverse a children and a div with JavaScript?

I need a function that traverses #paicasas and leaves the background of all children "casa1, casa2 ...". I tried to do this but I know it's far from right. function apagar(){ for(var i in document.getElementById('paicasa...
asked by 10.11.2014 / 21:12
1
answer

Continue to execute the loop even if a passage gives a problem

I am downloading the Bovespa stock data for the quantmod package. However, I still do not know why, in the data from Santander (SANB11) the getSymbols function of the package is giving problem and the loop for execution. Is ther...
asked by 20.02.2014 / 00:31
2
answers

Get previous element in foreach

Is it possible to take an element from the previous position to the current position using the foreach loop? For example, whenever I need to pick up an element earlier than the current loop position, I use the for loop as follow...
asked by 24.01.2018 / 14:47
1
answer

What is the difference between the two structures of the arrays and their repeating links in Javascript? [closed]

I would like to know which one is most suitable for working with arrays? var meu_array = new Array(1, 2, 3); var meu_array = [1, 2, 3]; Is there any performance difference between the 6 cases presented in the use of loop below? // foreac...
asked by 17.09.2015 / 21:55
1
answer

How do I make the next loop perform?

I have a list with two or more Strings: [Panel, Control] Now comes the problem: for (int i = 0; i < lista.size(); i++){ String linha = ""; while ((linha = leitura.readLine()) != null){ if (linha.contaens(lista.get(i)))...
asked by 25.03.2016 / 07:14