Balanced brackets: Difference between revisions
Content added Content deleted
m (→{{header|RPL}}: better ASSERT subroutine, using a list) |
(Replace println() with print(); replace output "syntaxhighlight" tag with "pre" tag) |
||
Line 2,428: | Line 2,428: | ||
for (String test : tests) |
for (String test : tests) |
||
{ |
{ |
||
console. |
console.print($"{test}{' ' * (longest-test.size)} {balanced(test) ? "OK" : "NOT OK"}"); |
||
} |
} |
||
} |
} |
||
Line 2,434: | Line 2,434: | ||
</syntaxhighlight> |
</syntaxhighlight> |
||
{{out}} |
|||
Resulting output: |
|||
<pre> |
|||
<syntaxhighlight> |
|||
[] OK |
[] OK |
||
[][] OK |
[][] OK |
||
Line 2,444: | Line 2,444: | ||
]][[]][[[[][]] NOT OK |
]][[]][[[[][]] NOT OK |
||
[[]]]][]][[][[[] NOT OK |
[[]]]][]][[][[[] NOT OK |
||
</pre> |
|||
</syntaxhighlight> |
|||
=={{header|Elena}}== |
=={{header|Elena}}== |