+ 1
11 Antworten
+ 4
you can use loops for many reasons.let me give you some examples
1-restarting any process even whole programme
2-creating arrays or lists even by user input
3- mostly for writing less code
4- printing things as necesary like invoices and its lines
5-force users to do things till they do it correctly
6-you can loop drawing things on screen may be sometimes forever (led messages work like that)
etc etc etc
+ 4
just one more example
one set of cards - 12345678910JQK
if you write full set you should write it 4 times
and also lets imagine you add color in it so
13 x 4 x 2 for full deck of cards
so you write loop to do that
loop for colors:
loop for types :
loop for one set:
very very less coding isnt it ?
+ 4
loops saves time and coding and it also help you to control while doing it
+ 3
here is a sample for csharp
+ 2
let me give you real examples
i read record from database then create invoice and i create invoice details by loops as many records i found in database by related record; loops save me writing many lines of code repeatedly
+ 1
Do you have any suggestions for how to understand loops
+ 1
Oh that I get. It's more specifically about the code itself
+ 1
That loop is to sort the deck of cards?
+ 1
Okay yeah it's kinda like sorting cards
+ 1
Yup I get that