asomiya 0.2.0

Control flow

Reading input

সোধা (xudha, “ask”) shows a question and reads one line that the user types.

ধৰা নাম = সোধা("আপোনাৰ নাম কি? ")
কোৱা("নমস্কাৰ, " + নাম)
Output
আপোনাৰ নাম কি? নমস্কাৰ, Rita
dhora naam = xudha("Tomar naam ki? ")
kowa("Nomoskar, " + naam)
Output
Tomar naam ki? Nomoskar, Rita

Numbers from input

সোধা always gives back text. Convert it with সংখ্যা (xonkhya), which gives খালী if the answer isn’t a number:

ধৰা উত্তৰ = সংখ্যা(সোধা("এটা সংখ্যা দিয়ক: "))
যদি (উত্তৰ == খালী) {
    কোৱা("সেইটো সংখ্যা নহয়")
} নহ'লে {
    কোৱা("দুগুণ:", উত্তৰ * ২)
}
Output
এটা সংখ্যা দিয়ক: দুগুণ: ৪২
dhora uttor = xonkhya(xudha("Ekta xonkhya diok: "))
jodi (uttor == khali) {
    kowa("eitu xonkhya nohoy")
} nohole {
    kowa("dugun:", uttor * 2)
}
Output
Ekta xonkhya diok: dugun: 42

Where input comes from

  • Terminal: the program waits for you to type a line and press Enter.
  • Playground: type answers in the Input box before you press Run, one answer per line.
  • When there is nothing left to read, সোধা gives খালী.