examples: simplify row builder using arrays

This commit is contained in:
a dinosaur 2023-09-11 20:50:41 +10:00
parent b0fbf3ee53
commit 0b43f1e968

View File

@ -1,14 +1,11 @@
func buildRow(str, a, b, c, d) {
let checkSeparator = "| "
print("|", str, checkSeparator)
if a { print("✅") } else { print("🚫") }
let checkSeparator = " "
print("|", str, "| ")
for i in [a, b, c, d] {
print(checkSeparator)
if b { print("✅") } else { print("🚫") }
print(checkSeparator)
if c { print("✅") } else { print("🚫") }
print(checkSeparator)
if d { print("✅") } else { print("🚫") }
println("|")
if a { print("✅|") } else { print("🚫|") }
}
println()
}
export func main() {
@ -29,5 +26,5 @@ export func main() {
buildRow("!a || b", (not false) or false, (not true) or false, (not false) or true, (not true) or true)
buildRow(" a || !b", false or (not false), true or (not false), false or (not true), true or (not true))
buildRow("!a || !b", (not false) or (not false), (not true) or (not false), (not false) or (not true), (not true) or (not true))
println("|-----------------------------------------------------|")
println("|------------------------------------------------------|")
}