hello everyone this is a GU from tutorial dr.com and welcome to PHP video series in this lecture we will see an example of a do-while loop so if you follow my series then in the last lecture we saw an example of how can we use while loop and now we will see how to use do I loop so I’m not creating any new file so I want to demonstrate the do-while loop in the same value of example so first of all I would like to remind what is the difference between while and do-while loop so the only difference is in case of while loop first it will check for the condition but if it is true then only it will enter into the loop and executes I’ll repeat the code as many times as possible in case of do-while loop first it will execute the loop one time then it will check further condition and based on the condition the repetative actions will occur so here the only difference is if in while loop we don’t know whether the script is executed are not in case of do while it will be executed at least once okay so let me create some example then it will be clear okay so so this is the syntax for do-while so let me use the same thing I do not want to confuse and just copy/paste e so this is the syntax do so what to do and then while this is the condition so Mike another condition is still my dollar count is less than R equals 10 so here what I will do so this is a while loop here this is so that we can differentiate between while loop and do-while loop okay let me save and open browser and let’s reload okay that is because the value is already more than 10 here so once this is done let me arrange allies the value no I should see so here it executed from 0 to 10 and 2 while also it is executed from 0 to 10 so it means there is no difference right yeah so if you see from this example it looks like there is no difference so let me take the same example and modify a little bit like instead of this one enter into the loop only if the condition is greater than or equal so then same thing here if the condition is greater than or equal so equals to 10 okay so here the condition is false and here the condition is false so let me save and reload so if you see this is a do-while loop 0 so independent of the condition the true while loop is executed once so first it will do and then check for the condition in case of while loop first it will check for the condition and then it will do the actions

Tags:






Youtube
Facebook
Google Plus
Twitter
TutorialDrive


Apache Zookeeper Tutorial

Apache Kafka Tutorial

Apache Kafka Security

Elasticserarch n Kibana

Java 8 Tutorial

Log4J Tutorial

Apache Storm Tutorial

SQLite Tutorial

Apache Ant Tutorial

Related Posts

blog

Apache Kafka Commands Cheat sheet

Spread the loveKafka Topics List existing topics bin/kafka-topics.sh –zookeeper localhost:2181 –list Purge a topic bin/kafka-topics.sh –zookeeper localhost:2181 –alter –topic mytopic –config retention.ms=1000 … wait a minute … bin/kafka-topics.sh –zookeeper localhost:2181 –alter –topic mytopic –delete-config retention.ms
Read more…

blog

What is Apache Maven | Apache Maven complete tutorial from scratch pdf

Spread the love In this post you will learn the complete tutorial of Apache Maven build tool What is Maven ? Apache Maven is a software project management and comprehension tool. Based on the concept
Read more…

blog

Practical Guide for Web Development in 2018

Spread the loveWelcome to my practical guide  for web development in 2018 in terms of  technology and career. Before we start I just want to  mention a few things, you don’t need to learn  everything that
Read more…