Jump to content

Balanced brackets: Difference between revisions

Line 4,235:
 
'', '[]', '][', '[][]', '][][', '[[][]]', '[]][[]' | ForEach-Object {
if ($_ -neeq "") { $s = $_"(Empty)" } else { $s = "(Empty)"$_ }
"{0}: {1,17}" -f $s.PadRight(8), "$(if (Test-BalancedBracket Brace $s) {'Is balanced.'} else {'Is not balanced.'})"
}
</lang>
{{Out}}
<pre>
(Empty) : Is balanced.
[] : Is balanced.
][ : Is not balanced.
[][] : Is balanced.
][][ : Is not balanced.
[[][]] : Is balanced.
[]][[] : Is not balanced.
</pre>
308

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.