Questions tagged as 'loops'

7
answers

Differences between x ++ and ++ x

In the code I see many times x++ in loops, but sometimes I find ++x . Is there any difference between these two expressions?     
asked by 03.12.2015 / 18:04
3
answers

Difference between FOR and FOR EACH [closed]

A colleague and I have just had an interesting debate: What is the difference between For and For Each ? I already know how it works in code, but from behind? Really what is the most advisable? In which cases should we use one...
asked by 15.09.2017 / 12:30
4
answers

for vs while - LOOP

I have these little questions about loops in java . What is the difference between for and while ? Is the while better for a short loop?
asked by 22.01.2017 / 11:34
3
answers

Touring java arrangement efficiently

Lately I wanted to start thinking more than solutions, to be effective at the time of programming. And that is why I run into the following question, and as the title says: What is the most efficient way to traverse an array in Java? And...
asked by 13.04.2017 / 14:36
4
answers

Understanding the for cycle

When we create a for cycle in any language, sometimes we do not understand the lines and variables that we develop and why we created them. Example: When we create a start variable (example i ) on we understand that it is...
asked by 12.02.2018 / 23:16
3
answers

For each in javascript?

In java you can: for (elemento e : array) Jquery $.each(arr, function() { in javascript I know what I can do for (var i = 0; i > 10; i ++) But is there any way to do a for-each in pure javascript?     
asked by 25.07.2016 / 09:58
2
answers

Doubt about matrix travel

I have a question about how to go through the even rows of a matrix, I put it this way: for(int i=2;i<=get_m();i+2) My question is: In the increment part of the row can i+2 be made to go through only the even rows?     
asked by 13.08.2017 / 14:28
5
answers

What is more effective? For or Foreach in PHP

Some time ago I have been programming in php. And I had the following doubt regarding the efficiency of the resources and the speed of how they behave. My question is this: What function is more effective when traversing an array? I w...
asked by 27.04.2017 / 17:19
2
answers

Go through an ArrayList and show one by one

I am using a for to go through a list of objects, but it only shows me the last one, in the console if it shows me that it goes through all, but in the Imageview it only shows the last one. Code: if(!L.isEmpty()){ for (B...
asked by 14.04.2017 / 21:10
1
answer

How to create a variable that cataloges in two groups the values that another variable takes in MATLAB

I have a variable "variant" that takes the following values: 1, 2, 3, 4, 5 and 6. What I need to do, is a new variable called amistad that takes value 1 for the cases in which the variante takes value 1, 3, 5 and that takes valu...
asked by 11.06.2016 / 22:19