main.aug
Command-line arguments · Source and specification
Files in this project
Code
aug
// aug-spec: "main.aug.md" explains this file. Read it before changes; refresh with aug spec.
try:
args = arguments()
print(value=args.length())
if args.length() > 0:
print(value=args.get(index=0))
numbers = List<int>(1, 2)
borrow numbers:
numbers.append(value=3)
print(value=numbers.get(index=2))
catch IndexError error:
print(value="unexpected index failure")aug
// aug-spec: "main.aug.md" explains this file. Read it before changes; refresh with aug spec.
try {
args = arguments()
print(value=args.length())
if args.length() > 0 {
print(value=args.get(index=0))
}
numbers = List<int>(1, 2)
borrow numbers {
numbers.append(value=3)
}
print(value=numbers.get(index=2))
}
catch IndexError error {
print(value="unexpected index failure")
}Compiled specification
Startup
It sets args to arguments. It prints the number of elements in args. If the number of elements in args is positive, it prints the item at index 0 in args. It sets numbers to a list of int containing 1, 2. source
With temporary permission to change numbers, it appends 3 to numbers. It prints the item at index 2 in numbers. If this work raises IndexError, it prints "unexpected index failure". source
Built-in operations follow the language reference.