Documentations - SRON
  • SRON's Official Documentation
  • Installation
  • Syntax of SRON
  • Executing a SRON code
  • Keywords in SRON
  • Comments in SRON
  • Datatypes in SRON
  • Variables in SRON
  • Memory Ownership Model
  • Operators in SRON
  • Math block
  • if elif else in SRON
  • Loops in SRON
    • For Loop
    • While Loop
    • Foreach Loop
  • Break & Continue
  • Functions in SRON
    • Print functions
    • User Input Functions
    • Type Conversion functions
    • Type Checking functions
    • Math functions
    • Char Functions
    • String Functions
    • List Functions
    • Miscellaneous functions
  • Return in SRON
  • Command Line Arguments
  • Free
  • Rotate
  • Console
  • Sample codes
  • Coding Convention
  • Frequently Asked Questions
  • Credits
  • Contact
  • Donate
Powered by GitBook
On this page

Loops in SRON

Loops are the most vital component of programming which is used to perform a set of tasks multiple times.

For example, if you want to print your name more than 10 times, then rather than writing your name 10 times, you can put it inside a loop given in SRON to perform this task.

SRON provides 3 types of Loop:

  • For

  • While

  • Foreach


{
    @ for loop demonstration

    name : MAIN
    for : {
        range : (Int i = 1, 11)
        println("Hello, SRON!")
    }
}
{
    @ while loop demonstration

    name : Main
    while : {
        condition : (true)
        println("Boooom!!")
    }
}
{
    @ foreach loop demonstration

    name : Main
    foreach : {
        on : (Any i , [1,2,3,4,5])
        println(i)
    }
}

Previousif elif else in SRONNextFor Loop

Last updated 6 months ago