New course! Every coder should learn Generative AI!
Try a free lesson- 6
please explain
+ 14
You have finished 13 tutorials, so you have passed stuff that's far more complicated than loops several times.
This doesn't make sense.
I've seen that a few times, 'badge veterans' asking about the most basic stuff.
So please enlighten me: What's going on here?
+ 8
I remember that I also occasionally bought an answer with xp.
But whenever I was so confused that I would have had to buy them one after another or look up the answers in the comments in order to go on, I would see that as a warning sign that I didn't really understand.
Asking a question like 'I don't understand for loops' after finishing 13 full tutorials, how could that ever happen?
You would have to buy and cheat your way through all of these tutorials from beginning to end. Who would do such a thing? It takes quite a while, is completely useless and should be boring as hell.
I mean, loops can be messy, I struggle with them, too, here and there. But after 13 tutorials, I should understand what a for loop, generally, is!
+ 5
HonFu , Basically, there are two types of learners. The performance oriented ones who just want to have the appearance of being good at programming without actually doing much work i.e. copy and paste code from others, do loads of challenges to gain loads of points and completing loads of courses without truly underestanding jack.
then there is the mastery oriented ones who are more interested in truly understanding the ins and outs of a subject, they are more likely to produce code from scratch and are more likely to take their time to complete a course and revisit it once finished.
+ 4
Monical, but to what end?
+ 3
e.g. you want to run a code snippet 10 times:
loop(10 times){
code snipped;
}
But there isn't a well known language which supporting this format.
Instead you have to choose between a while and a for loop.
Both loops are almost the same.
They are just repeating code as long as a condition is set true.
The for loop:
for(condition){ code; }
bit you should break the condition term into 3 parts:
for(a variable with a value; condition; increasing size of the value){}
or practicaly:
for(var value=1; value < 11; value++){
//code
}
+ 3
HonFu It is called the imposter syndrome.
+ 2
Mostly in every language loops are same ,once you got the point you have not to worry about other languages.
+ 2
for
(let ch
of
"SoloLearn") {
console.log(ch);
}
+ 1
Which language would you prefer to use?
+ 1
Loop is like repeating or doing a process till a condition is met
+ 1
Hello Saeed Haghighi, For loop to me is just a compressed while loop.
I think the way you would understand "For loop" easily is to go again and take the lessons on "while loop".
Thank you.
+ 1
if u want to repeaet the expression for more than 1 time, then the best way to execute ur code is to put it in a loop. To understand it,follow the key words
1.initialization.
2.condition.
3.increment/decrement.
Then go through loops one by one
+ 1
you can loop with the loop operator
+ 1
and with while
+ 1
and with for
+ 1
mov r16, TIMES
loop:
//code
dec r16
jnz loop
0
Fill in the blanks to iterate through all the characters using the for...of loop.
(let ch
"SoloLearn") {
console.log(ch);
}
0
for
of
0
const printOdds = (arr)
=>
{
arr
.forEach(
el
=> {
if (el % 2 != 0) console.log(el);
});
}