code wiki / (root) / nx_rw_andor.nx

nx_rw_andor.nx source

↩ module page · 16 lines · 516 B

1// nx_rw_andor.nx -- TRAP WITNESS (pack-rules vet). Tactic under test: && and || in conditions 2// (the pack says avoid; nest ifs instead). Exit 0 iff both operators evaluate correctly. 3// license_tier: ORIGINAL 4import "nx_syscalls.nx" 5 6func main(argc: i64, argv: *i64) -> i64 { 7 let a: i64 = 3 8 let b: i64 = 0 9 var ok: i64 = 0 10 if a > 1 && a < 5 { ok = ok + 1 } 11 if b == 1 || a == 3 { ok = ok + 1 } 12 if a > 9 && a < 5 { ok = ok + 100 } 13 if ok == 2 { sys_exit(0) } 14 sys_exit(1) 15 return 0 16}