Skip to content

Commit

Permalink
fix: Change transliteration in for-loop and while-loop (#22)
Browse files Browse the repository at this point in the history
Co-authored-by: Ashish Zapadiya <[email protected]>
  • Loading branch information
zapadiya007 and Ashish Zapadiya authored Oct 20, 2024
1 parent 3f35e57 commit d9402c2
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 14 deletions.
23 changes: 12 additions & 11 deletions for-loop.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
---
sort: 9
---

## चक्रम् (for loop)

>_transliteration: chakram, meaning: round-loop_
> _transliteration: chakram, meaning: round-loop_
चक्रम् loops are a great way to run code a certain or changing amount of ways in a concise manner. चक्रम् takes in 3 parameters initial value, and condition, and a step size.

Expand All @@ -15,7 +16,7 @@ For example, here is a for loop that `वद` all of the numbers ० to ९
{
# चक्रम् takes in 3 parameters initial value, and condition, and a step size
वद("अ =",अ);
}
}
```

This ends up outputting
Expand All @@ -35,18 +36,18 @@ This ends up outputting

### Viram:

you can stop the चक्रम् loop between the process by using the
you can stop the चक्रम् loop between the process by using the

**विराम** (_transliteration: virAm, meaning: stop_) keyword:

```vedic
# This will print only till ५, it will break after अ = ५
चक्र(मान अ = ०; अ < १०; अ = अ+ १){
यदि (अ >= ५){
विराम; # viram is like continue
विराम; # viram is like break
}
वद("अ =>",अ);
}
वद("अ =>",अ);
}
```

**output**
Expand All @@ -61,18 +62,18 @@ you can stop the चक्रम् loop between the process by using the

### Agrim:

you can skip the चक्रम् loop between the process by using the
you can skip the चक्रम् loop between the process by using the

**विराम** (_transliteration: AgrIm, meaning: skip_) keyword:
**अग्रिम** (_transliteration: AgrIm, meaning: skip_) keyword:

```vedic
# This will print only till ५, it will skip after अ = २
चक्र(मान अ = ०; अ < ५; अ = अ+ १){
यदि (अ == २){
अग्रिम; # Agrim is like skip
अग्रिम; # Agrim is like continue
}
वद("अ =>",अ);
}
}
```

**output**
Expand All @@ -82,4 +83,4 @@ you can skip the चक्रम् loop between the process by using the
अ = १
अ = ३
अ = ४
```
```
7 changes: 4 additions & 3 deletions while-loop.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
---
sort: 10
---

## पर्यन्तम् (while loop)

>_transliteration: chakram, meaning: round-loop_
> _transliteration: Paryantam, meaning: round-loop_
Vedic includes `पर्यन्तम्` loop to execute code repeatedly till it satisfies a specified condition. Unlike `चक्रम्` loop, `पर्यन्तम्` loop only requires condition expression.

Expand All @@ -16,7 +17,7 @@ For example, here is a for loop that `वद` all of the numbers ० to ९
{
वद(अ);
अ = अ+ १;
}
}
```

**Output:**
Expand All @@ -30,4 +31,4 @@ For example, here is a for loop that `वद` all of the numbers ० to ९
```

> you can also use **विराम** and **विराम** keyword in पर्यन्तम् aslo same as चक्रम् loop
> you can also use **विराम** and **अग्रिम** keyword in पर्यन्तम् aslo same as चक्रम् loop

0 comments on commit d9402c2

Please sign in to comment.