करो
Translation status: हिन्दी reader-locale proof. Term names and code fences follow the hi pack; supporting prose may still be English.
Starts a scoped do-while style loop.
Aliases: do
Syntax: करो <block> [पकड़ो <name> <block>] [जबतक <condition>]
Category#
control-flow
Related#
Examples#
radix/corpus/fac/fac-cape.fab (canonical · keyword)#
Starts a scoped do-while style loop.
# =============================================================================
# करो — Starts a scoped do-while style loop
# =============================================================================
#
# What this teaches:
# • Starts a scoped do-while style loop.
# • Related keywords: जबतक, पकड़ो, समापन, जारी
#
# Common mistakes:
# • Using `पकड़ो` on a non-`करो` block — `पकड़ो` only attaches to `करो` statements, not arbitrary blocks.
#
# See also: जबतक, पकड़ो, समापन, जारी
# =============================================================================
# करो — try block with पकड़ो error handler
#
# करो { <body> }
# पकड़ो err { <handler> }
#
# GRAMMAR:
# facStmt :← 'करो' block 'पकड़ो' ident block
#
# EXPECTED OUTPUT:
# none — success path then simulated failure on attempt 2
#
# BACKEND:
# Rust/Go: करो/cape not yet emitted — compile-only smoke.
main {
do {
print "Block executed successfully"
}
catch err {
print "Caught error: §"(err.nuntius)
}
# इधरफेंको on second attempt; पकड़ो recovers and prints err.nuntius
var int attempts ← 0
do {
attempts ← attempts + 1
print "Attempt §"(attempts)
if attempts ≡ 2 {
throw "Simulated failure"
}
}
catch err {
print "Failed on attempt §: §"(attempts, err.nuntius)
}
}