Skip to content

Latest commit

 

History

History
executable file
·
36 lines (28 loc) · 940 Bytes

if-else.md

File metadata and controls

executable file
·
36 lines (28 loc) · 940 Bytes
sort
8

यदि-अथ (if-else)

transliteration: yadi, meaning: if

transliteration: atha, meaning: else

Like many programming languages, vedic also has

  • यदि - if
  • अथ - else
  • अथ यदि - else if

expressions for conditional control flow.

मान आयु = ३२;
यदि (आयु == २५) {
  वद("वयं सम वयस्काः एव"); # We're the same age
}
अथ यदि (आयु > २५) {
  वद("वयं सम वयस्काः न एव"); # We're not the same age
}
अथ {
  वद("मम अपेक्षया कनिष्ठः वा"); # Younger to me
}

output

वयं सम वयस्काः न एव

Note : The statements in the यदि-अथ must be enclosed by curly brackets ({ and }) they are not optional. Multiple statements can be used inside the branches.