6 Replies - 274 Views - Last Post: 23 October 2017 - 08:59 AM Rate Topic: -----

#1 salv236  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 42
  • Joined: 04-January 15

double for loops

Posted 23 October 2017 - 06:13 AM

I did not know where to insert this post, my apologies in advance if this is the incorrect place,
my question is targeted to all experienced developers, throughout your careers have you used
double for loops frequently?

The reason i am asking this question is because i am struggling to grasp the concepts.

Thanks, wishing you all a great day.

salv236
Is This A Good Question/Topic? 0
  • +

Replies To: double for loops

#2 astonecipher  Icon User is offline

  • Too busy for this
  • member icon

Reputation: 2330
  • View blog
  • Posts: 9,366
  • Joined: 03-December 12

Re: double for loops

Posted 23 October 2017 - 06:23 AM

Do you mean a nested loop?
Was This Post Helpful? 0
  • +
  • -

#3 Dormilich  Icon User is offline

  • 痛覚残留
  • member icon

Reputation: 4136
  • View blog
  • Posts: 13,051
  • Joined: 08-June 10

Re: double for loops

Posted 23 October 2017 - 06:33 AM

Quote

The reason i am asking this question is because i am struggling to grasp the concepts.

What concept? Nested loops are the same concept as single loops, only that the data are coming from another loop.

using functions to structure the code helps immensely for that.
Was This Post Helpful? 0
  • +
  • -

#4 salv236  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 42
  • Joined: 04-January 15

Re: double for loops

Posted 23 October 2017 - 07:07 AM

Thanks for your reply, i understand what a for loop can do on its own but when its nested thats
where i find complications, i.e understanding what value will be displayed upon each iteration.

This post has been edited by andrewsw: 23 October 2017 - 07:17 AM
Reason for edit:: removed previous quote, use the REPLY button

Was This Post Helpful? 0
  • +
  • -

#5 Dormilich  Icon User is offline

  • 痛覚残留
  • member icon

Reputation: 4136
  • View blog
  • Posts: 13,051
  • Joined: 08-June 10

Re: double for loops

Posted 23 October 2017 - 07:27 AM

then have a look at the data you feed to the second loop.
Was This Post Helpful? 0
  • +
  • -

#6 andrewsw  Icon User is offline

  • the case is sol-ved
  • member icon

Reputation: 6375
  • View blog
  • Posts: 25,756
  • Joined: 12-December 12

Re: double for loops

Posted 23 October 2017 - 07:37 AM

Nested loops could iterate a multi-dimensional array. For example, your data structure might represent a table of data and you want to iterate its, effectively, rows and columns.

You might also iterate the rows and columns returned from a database query (although iterating the columns is generally less useful, as they would likely represent a variety of data types).
Was This Post Helpful? 0
  • +
  • -

#7 CTphpnwb  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 3714
  • Posts: 13,467
  • Joined: 08-August 08

Re: double for loops

Posted 23 October 2017 - 08:59 AM

You'll learn this better if you try an example. Pick something, try it, and post the code along with a description of any problem you have with it.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1