Loops & Iteration (पर्यंत लूप)
पर्यंत <शर्त> { ... }
The पर्यंत keyword (meaning "until / while") repeats a block of code continuously as long as the test condition remains खरे.
Counter Loop Example
while.mr
चल क्र = १
पर्यंत क्र <= ५ {
छापा(क्र)
चल क्र = क्र + १
}
// Output:
// 1
// 2
// 3
// 4
// 5Accumulator Loop (Sum of Numbers)
sum.mr
चल i = १
चल एकूण_बेरीज = ०
पर्यंत i <= १० {
चल एकूण_बेरीज = एकूण_बेरीज + i
चल i = i + १
}
छापा("१ ते १० ची बेरीज:")
छापा(एकूण_बेरीज) // Prints 55