Questions tagged as 'loop'

1
answer

How to do a foreach loop with limit in C #?

How can I do a foreach loop with boundary, for example I have a dictionary with 100 items and I want to loop item 20 up to 50 how can I do this in C #.     
asked by 18.06.2016 / 06:23
2
answers

Foreach is returning only one record

I have a problem with my code. I have the following code: <?php require('class/habeo.class.php'); $Habeo->DuplicateRegister('contatos', array('id'=>'1', 'id'=>'6')); ?> This class duplicates the records I have in the database...
asked by 06.07.2014 / 05:11
2
answers

Automate the creation of numbers in a loop in R

The digits after ^ ( 1 , 2 and 3 ) are the values that I want to automate (incrementally: from 1 to ith value): var1<-rnorm(3,5000,1300)/1.15^1 var2<-rnorm(3,5000,1300)/1.15^2 var3<-rnorm(3,5000,1300)/1.15^...
asked by 20.08.2018 / 05:28
3
answers

Javascript function does not respect loop conditions

Good afternoon, I'm new here and I'm using Mozilla Firefox JavaScript Scratchpad to run Javascript tags. It will really suit my needs, however the while loop condition of the while loop is not working (for also did not work). Also, the varia...
asked by 23.10.2015 / 20:25
2
answers

Create sequential counter

I need to create an occurrence count column of a present value in another column. As, for example, count in column "y" of elements present in column "x": x y 1 A 1 2 B 1 3 A 2 4 C 1 5 B 2 6 A 3 Pr...
asked by 20.06.2017 / 15:30
2
answers

Recursive method or loop to populate or list an n-dimensional array

I'm trying to construct a method able to fill an n-dimensional array at all positions, for example: I have a 2-dimensional array, where that array is 2x2 with only 2 dimensions on a Cartesian plane, for example. I would like the same method t...
asked by 13.11.2017 / 02:32
2
answers

Show an object / variable with different names in R?

Considering the following routine: x <- 1:10 for (i in 1:length(x)) { ## Nome da variável: nomevar <- paste0("Var_", i) var <- x[i] + 2 assign(nomevar, var) print(nomevar) # aqui esta minha duvida }     
asked by 07.01.2016 / 17:47
3
answers

How to remove the last character, save the result to a variable and use the variable outside the foreach?

I have a code PHP like this: foreach ($rows as $obj) : $all_ids = $obj->ID . ', '; endforeach; .. whose output is 125, 148, 157, 169, 185, How to remove the last comma and save the rest of the output in a variable...
asked by 30.07.2015 / 01:59
1
answer

In a matrix Z of elements (i, j) how to assign the value 1 when i = j? (software R)

By the following condition: ifelse(??, 1, Z/(1+1)) What to put in place of "??" so that R understands that when i = j in the matrix Z, I want to assign the value 1?     
asked by 17.06.2017 / 03:38
1
answer

Variable with unassigned value within a FOR Loop

int i; string cpf; cpf = "11111111111"; DbConnection cnx = ADO_Utils.GetConnection(); DbCommand cmd = ADO_Utils.GetComando(cnx); cmd.CommandType = CommandType.Text; for (i = 1; i < Convert.ToInt32(txbQtde.Text); i++...
asked by 21.04.2016 / 03:59