Loops in Dart In Hindi - Loop Control Statements:-

 Programming में loop  का मतलब होता है बार बार एक ही कोड को दोहराना किसी एक condition के आधार पर,,  जब तक की वो एक निश्चित result तक न पहुंच जाए या condition, false  न होजाये। 

दोस्तों loop की हेल्प से हम अपनी बहुत सारी प्रॉब्लम को solve  कर लेते है जैसे की मान लीजिये हमने स्क्रीन पर एक बार hello  प्रिंट करना है तो हम सिंपल print वाला कोड लिख देंगे लेकिन यदि हमे "hello" को स्क्रीन पर 2000 बार प्रिंट करना हो तो हमे बार बार प्रिंट स्टेटमेंट लिखनी पड़ेगी इस प्रॉब्लम को लूप solve कर  देता है  loop की help से हम कुछ line of code से ही "hello " या किसी भी और statement को जितना चाहे उतनी बार प्रिंट या execute करवा सकते है।  

प्रोग्रामिंग में तीन तरह के loop होते है  while loop, do-while loop, For Loop हम एक एक करके इन तीनो का अध्यन करेंगे। आईये पहले हम तीनो loops की syntax देखते है कोड की मदद से और जानते है की loop में क्या क्या होता है और उनका नाम क्या होता है अपने next tutorial में हम एक-एक लूप को विस्तार से पढ़ेंगे। 


While loop--

syntax--


 while (condition){

                  //execute this if condition is true

                   increment OR decrement Operator;

}


code--



Do-While Loop--

syntax-

do{

//execute this code

i++

}while(condition)


code--



For Loop--

syntax--

for(condition and increment or decrement)

{

//execute this code

}

code --


loops में ye दो terms,counter variables and increment or decrement operator ,use  होती है चलिए इनका अध्यन करते है। 


Counter variable kya hota hai:-

  Counter  variable --काउंटर variable भी एक normal वेरिएबल ही होता है ये count करता है की कोड कितनी बार Execute हुआ या loop कितनी बार चला। ऊपर कोड में  "i"  एक काउंटर वेरिएबल है। 


Increment Or Decrement Operator kya hote hai:-

Increment Operator -इन्क्रीमेंट ऑपरेटर  ("++")  एक ऐसा ऑपरेटर होता है जो किसी  वेरिएबल के साथ use  करने पर उसकी वैल्यू में "1" ऐड कर  देता है।  आईये इसका उदाहरन देखते है। 


    Int i =5;    

    I++;

    Now i will be =6 

    I++;

    Now  i = 7 ;


तो जैसा कि आप ऊपर कोड में  देख रहे है increment ऑपरेटर ने counter variable "i " की  वैल्यू में "+1" ऐड कर दिया  है इन्क्रीमेंट operator  use करने से पहले i  की value 5 थी बाद में use  करने के बाद value ६६ हो गयी 

 ठीक इसी प्रकार decrement Operator,, primary value(counter variable)  में 1 को minus कर देता है  आईये decrement operator  का भी example  देखते है 

     Int i =5;

     i--;

     Now i=4 

     If again i--;

     Now i = 3




Next--While Loop, Do-While Loop and For Loop in Dart 

Previous






  

1 Comments

  1. You don’t should deposit any of your individual money to have enjoyable on-line, but need to|if you would like to} win money prizes, you’ll have access to a variety of|quite a lot of|a big selection of} safe deposit and payout choices. Our high on-line casinos settle for a variety of|quite a lot of|a big 우리카지노 selection of} cryptocurrencies, e-wallets, and traditional fiat banking methods. Slots Empire could be very aptly named for it has a complete empire of slots for actual money that you just can} enjoy. They cater to all types of gamers with their vast number of well-known actual money on-line slots created by RealTime Gaming. Slots.lv’s number of 3D on-line slots for actual money is also be|can be} unbelievable with many vivid top-class slots that provide an actual video game-like expertise.

    ReplyDelete

Post a Comment