Hi guyes,
This is tutorial 2,
The previous tutorial we have learnt how to use for loop pug/jade, scss, javascript, python(backend) Here you can see
This tutorial we will use basic while loop in our stack web development.
1. PUG/JADE
In this pug/jade tutorial we can use this pug to html converter for practice purpose PUG TO HTML
Example 1
- var i=0
ul
while i < 10
li= i++
2. SCSS
Example 1
$border: 1;
@while $border < 10+1{
li:nth-child(#{$border}){
border: #{$border}px solid red;
}
$border: $border+1
}
3. Javascript
while loop
Example 1
let li = document.querySelectorAll('li');
let i = 0;
while(i < li.length){
li[i].style.color = 'yellow';
console.log(i)
i++;
}
while loop with do (js)
Example 2
do{
li[i].style.color = 'yellow';
console.log(i)
i++;
}
while(i < li.length)
"do" and while is very simple to use and the "while" making the condition and the "do" execute the callback.
Finally, Python
4. Python
Example 1
count = 0
while count < 10:
print(count)
count+=1
It almost looks little same as javascript but python has only 2 primitive loop
- For
- while
This is my sort tutorial hope you like it.
if you like this sort tutorial please like, comments.
Thanks.
Top comments (0)