leo/tests/compiler/statements/all_loops_fail.leo
Collin Chin 416d8d5ad9
fix nit
2022-05-17 11:36:04 -04:00

33 lines
691 B
Plaintext

/*
namespace: Compile
expectation: Fail
input_file: inputs/dummy.in
# inclusive loops are currently disallowed
*/
function main(k: bool) -> bool {
let reverse: u32 = 0u32;
for i: u32 in 9u32..0u32 {
reverse = reverse + i;
}
let forward: u32 = 0u32;
for x: u32 in 0u32..10u32 {
forward = forward + x;
}
let reverse_inclusive: u32 = 0u32;
for a: u32 in 10u32..=0u32 {
reverse_inclusive = reverse_inclusive + a;
}
let forward_inclusive: u32 = 0u32;
for b: u32 in 0u32..=10u32 {
forward_inclusive = forward_inclusive + b;
}
return (reverse == forward) && (reverse_inclusive == forward_inclusive) && k;
}