SlideShare a Scribd company logo
- R. M. Dharaneesh
 Loops
 For loops
 Nested for loops
 While loops
 break
 Repeat loops
 next
 In computer programming, a loop is a sequence of instructions that are
continually repeated until a certain condition is reached.
 Loops can either be entry-controlled or exit-controlled.
 Entry-controlled loops run only if the condition for the looping process stays true.
 Exit-controlled loops run at least once, regardless of the condition, conditions are
checked for only at the end of the loop block.
 For loops are an entry-controlled type of loops, i.e., conditions are given on the
entry of the loop.
 If the conditions are not satisfied, then the loop doesn't execute.
 Otherwise, the loop runs until the condition becomes false.
 It is used to iterate over the items of a sequence, usually only when the range of
the sequence is known.
 Update statements are not needed as the loop automatically updates the counter
variable.
 For loops can be nested, i.e., for loops can be placed inside of other for loops.
 If for example, the outer loop will make 'm' iterations and the inner loop will make
'n' iterations, then the total number of iterations made will be m * n.
 While loops are another entry-controlled type of loop in R.
 While loops are usually used when the total number of iterations are not known,
although they can also be used when the number of iterations are known.
 Update statements have to be explicitly mentioned in while loops.
 The 'break' keyword is used to 'break' out of a loop abruptly in between its
execution.
 Once a 'break' statement is encountered in a loop, the control exits out of the loop
completely.
 It is a simple loop that will run the same statement or a group of statements
repeatedly until the stop condition has been encountered.
 Repeat loop does not have any condition to terminate the loop, a programmer
must specifically place a condition within the loop’s body and use the declaration
of a break statement to terminate this loop.
 If no condition is present in the body of the repeat loop then it will iterate
infinitely.
 The 'next' keyword is used to skip the current iteration in a loop.
 Once the 'next' keyword is encountered in a loop, the control will instantly skip
that iteration.
Thank
you

More Related Content

What's hot

Nested loop in C language
Nested loop in C languageNested loop in C language
Nested loop in C language
ErumShammim
 

What's hot (20)

Loops
LoopsLoops
Loops
 
File handling
File handlingFile handling
File handling
 
Python Exception Handling
Python Exception HandlingPython Exception Handling
Python Exception Handling
 
Python Decision Making
Python Decision MakingPython Decision Making
Python Decision Making
 
Python If Else | If Else Statement In Python | Edureka
Python If Else | If Else Statement In Python | EdurekaPython If Else | If Else Statement In Python | Edureka
Python If Else | If Else Statement In Python | Edureka
 
Control structures in c++
Control structures in c++Control structures in c++
Control structures in c++
 
prokaryotic transcription.pptx
prokaryotic transcription.pptxprokaryotic transcription.pptx
prokaryotic transcription.pptx
 
Conditionalstatement
ConditionalstatementConditionalstatement
Conditionalstatement
 
Loops Basics
Loops BasicsLoops Basics
Loops Basics
 
Values and Data types in python
Values and Data types in pythonValues and Data types in python
Values and Data types in python
 
Daa unit 1
Daa unit 1Daa unit 1
Daa unit 1
 
Control structure C++
Control structure C++Control structure C++
Control structure C++
 
Exception handling and function in python
Exception handling and function in pythonException handling and function in python
Exception handling and function in python
 
basic of desicion control statement in python
basic of  desicion control statement in pythonbasic of  desicion control statement in python
basic of desicion control statement in python
 
Nested Loops in C.pptx
Nested Loops in C.pptxNested Loops in C.pptx
Nested Loops in C.pptx
 
Dna replication in prokaryotes
Dna replication in prokaryotesDna replication in prokaryotes
Dna replication in prokaryotes
 
Python Tutorial
Python TutorialPython Tutorial
Python Tutorial
 
Functions in C++
Functions in C++Functions in C++
Functions in C++
 
Loops c++
Loops c++Loops c++
Loops c++
 
Nested loop in C language
Nested loop in C languageNested loop in C language
Nested loop in C language
 

Similar to Loops in R

Chapter 9 - Loops in C++
Chapter 9 - Loops in C++Chapter 9 - Loops in C++
Chapter 9 - Loops in C++
Deepak Singh
 

Similar to Loops in R (20)

Computer programming 2 Lesson 8
Computer programming 2  Lesson 8Computer programming 2  Lesson 8
Computer programming 2 Lesson 8
 
Introduction to loops cpu
Introduction to loops  cpuIntroduction to loops  cpu
Introduction to loops cpu
 
Cse lecture-7-c loop
Cse lecture-7-c loopCse lecture-7-c loop
Cse lecture-7-c loop
 
Decision making and looping
Decision making and loopingDecision making and looping
Decision making and looping
 
loops and iteration.docx
loops and iteration.docxloops and iteration.docx
loops and iteration.docx
 
Programming in python - Week 4
Programming in python  - Week 4Programming in python  - Week 4
Programming in python - Week 4
 
Java Repetiotion Statements
Java Repetiotion StatementsJava Repetiotion Statements
Java Repetiotion Statements
 
Chapter 9 - Loops in C++
Chapter 9 - Loops in C++Chapter 9 - Loops in C++
Chapter 9 - Loops in C++
 
Control Structures Python like conditions and loops
Control Structures Python like conditions and loopsControl Structures Python like conditions and loops
Control Structures Python like conditions and loops
 
C language 2
C language 2C language 2
C language 2
 
Chapter 12 Computer Science ( ICS 12).pdf
Chapter 12 Computer Science ( ICS 12).pdfChapter 12 Computer Science ( ICS 12).pdf
Chapter 12 Computer Science ( ICS 12).pdf
 
dizital pods session 5-loops.pptx
dizital pods session 5-loops.pptxdizital pods session 5-loops.pptx
dizital pods session 5-loops.pptx
 
Loop in C Properties & Applications
Loop in C Properties & ApplicationsLoop in C Properties & Applications
Loop in C Properties & Applications
 
R loops
R   loopsR   loops
R loops
 
Loop structures
Loop structuresLoop structures
Loop structures
 
Control statements in java
Control statements in javaControl statements in java
Control statements in java
 
presentation on powerpoint template.pptx
presentation on powerpoint template.pptxpresentation on powerpoint template.pptx
presentation on powerpoint template.pptx
 
Loops
LoopsLoops
Loops
 
Unit II chapter 4 Loops in C
Unit II chapter 4 Loops in CUnit II chapter 4 Loops in C
Unit II chapter 4 Loops in C
 
python.pptx
python.pptxpython.pptx
python.pptx
 

Recently uploaded

Search and Society: Reimagining Information Access for Radical Futures
Search and Society: Reimagining Information Access for Radical FuturesSearch and Society: Reimagining Information Access for Radical Futures
Search and Society: Reimagining Information Access for Radical Futures
Bhaskar Mitra
 
Essentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersEssentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with Parameters
Safe Software
 

Recently uploaded (20)

Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........
 
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
 
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
 
Search and Society: Reimagining Information Access for Radical Futures
Search and Society: Reimagining Information Access for Radical FuturesSearch and Society: Reimagining Information Access for Radical Futures
Search and Society: Reimagining Information Access for Radical Futures
 
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
 
UiPath Test Automation using UiPath Test Suite series, part 2
UiPath Test Automation using UiPath Test Suite series, part 2UiPath Test Automation using UiPath Test Suite series, part 2
UiPath Test Automation using UiPath Test Suite series, part 2
 
JMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and GrafanaJMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and Grafana
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
 
UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3
 
Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*
 
Essentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersEssentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with Parameters
 
НАДІЯ ФЕДЮШКО БАЦ «Професійне зростання QA спеціаліста»
НАДІЯ ФЕДЮШКО БАЦ  «Професійне зростання QA спеціаліста»НАДІЯ ФЕДЮШКО БАЦ  «Професійне зростання QA спеціаліста»
НАДІЯ ФЕДЮШКО БАЦ «Професійне зростання QA спеціаліста»
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
 
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...
 
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualitySoftware Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
 
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
 
Speed Wins: From Kafka to APIs in Minutes
Speed Wins: From Kafka to APIs in MinutesSpeed Wins: From Kafka to APIs in Minutes
Speed Wins: From Kafka to APIs in Minutes
 
Knowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and backKnowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and back
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
 
"Impact of front-end architecture on development cost", Viktor Turskyi
"Impact of front-end architecture on development cost", Viktor Turskyi"Impact of front-end architecture on development cost", Viktor Turskyi
"Impact of front-end architecture on development cost", Viktor Turskyi
 

Loops in R

  • 1. - R. M. Dharaneesh
  • 2.  Loops  For loops  Nested for loops  While loops  break  Repeat loops  next
  • 3.  In computer programming, a loop is a sequence of instructions that are continually repeated until a certain condition is reached.  Loops can either be entry-controlled or exit-controlled.  Entry-controlled loops run only if the condition for the looping process stays true.  Exit-controlled loops run at least once, regardless of the condition, conditions are checked for only at the end of the loop block.
  • 4.
  • 5.  For loops are an entry-controlled type of loops, i.e., conditions are given on the entry of the loop.  If the conditions are not satisfied, then the loop doesn't execute.  Otherwise, the loop runs until the condition becomes false.  It is used to iterate over the items of a sequence, usually only when the range of the sequence is known.  Update statements are not needed as the loop automatically updates the counter variable.
  • 6.
  • 7.  For loops can be nested, i.e., for loops can be placed inside of other for loops.  If for example, the outer loop will make 'm' iterations and the inner loop will make 'n' iterations, then the total number of iterations made will be m * n.
  • 8.
  • 9.  While loops are another entry-controlled type of loop in R.  While loops are usually used when the total number of iterations are not known, although they can also be used when the number of iterations are known.  Update statements have to be explicitly mentioned in while loops.
  • 10.
  • 11.  The 'break' keyword is used to 'break' out of a loop abruptly in between its execution.  Once a 'break' statement is encountered in a loop, the control exits out of the loop completely.
  • 12.  It is a simple loop that will run the same statement or a group of statements repeatedly until the stop condition has been encountered.  Repeat loop does not have any condition to terminate the loop, a programmer must specifically place a condition within the loop’s body and use the declaration of a break statement to terminate this loop.  If no condition is present in the body of the repeat loop then it will iterate infinitely.
  • 13.
  • 14.  The 'next' keyword is used to skip the current iteration in a loop.  Once the 'next' keyword is encountered in a loop, the control will instantly skip that iteration.
  • 15.