Implement Phase 5: Control flow & exceptions in MIR/VM - Core functionality complete
Co-authored-by: moe-charm <217100418+moe-charm@users.noreply.github.com>
This commit is contained in:
21
test_mir_control_flow.nyash
Normal file
21
test_mir_control_flow.nyash
Normal file
@ -0,0 +1,21 @@
|
||||
// Test MIR control flow and exception handling - Phase 5
|
||||
|
||||
// Test loop functionality
|
||||
local counter
|
||||
counter = 0
|
||||
|
||||
loop(counter < 3) {
|
||||
print(counter)
|
||||
counter = counter + 1
|
||||
}
|
||||
|
||||
// Test try/catch functionality
|
||||
try {
|
||||
print("In try block")
|
||||
throw "Test exception"
|
||||
print("This should not execute")
|
||||
} catch (exception) {
|
||||
print("Caught exception")
|
||||
}
|
||||
|
||||
print("Program completed")
|
||||
Reference in New Issue
Block a user