New answers tagged for-loop
Score of 2
2
votes
How to put many different mysqli_query into the same array with a for loop
I could solve it.
I had to start $i in the second for loop with 0 AND the condition had to be changed to $i < $number[0] as the first index of the referenced $sql_command[] is 0.
That was the ...
Score of 5
5
votes
How to put many different mysqli_query into the same array with a for loop
It looks like a design error. Instead of using a loop with
... WHERE vsz_id=$i ...
you can use without loop
... WHERE vsz_id between 0 and $number[0] ...
If you have an array named $wanted with an ...
Score of 0
0
votes
Which is the better way to calculate the size of one array in a for statement?
The generally recommended practice is that you get the count once and store it in a variable before the start of the loop (the first section of for loop). This prevents "extended" looping by ...
Score of 0
0
votes
What's wrong with my code for checking whether a number is prime?
You need to break when the number fails like:
user_input = input("pick a number ")
user_input = int(user_input) # make it a number
for i in range(2, user_input): # stops at user_input-1
...
Top 50 recent answers are included
Related Tags
for-loop × 71938python × 17780
loops × 10596
r × 9003
javascript × 8878
arrays × 8655
java × 7963
if-statement × 4638
list × 4162
c++ × 3322
c × 3150
python-3.x × 3132
php × 2940
while-loop × 2786
pandas × 2401
dataframe × 2358
c# × 2104
function × 2023
matlab × 1727
batch-file × 1699
string × 1666
dictionary × 1584
bash × 1567
foreach × 1498
vba × 1463