Anonymous user
Balanced brackets: Difference between revisions
Added Befunge check of whether a string is balanced
m (→{{header|Brat}}: Use prototype) |
(Added Befunge check of whether a string is balanced) |
||
Line 248:
][[]][ NOT OK
OK
=={{header|BBC BASIC}}==
<lang bbcbasic>FOR x%=1 TO 10
Line 288 ⟶ 289:
Bracket string ][]][[ is not OK.
Bracket string []][][][[] is not OK.</pre>
=={{header|Befunge}}==
{{works with|befungee}}
This code implements the second part of the task: it reads from standard input an arbitrary string of opening and closing brackets, and checks whether it's balanced or not.
<lang Befunge>v > "KO TON" ,,,,,, v
> ~ : 25*- #v_ $ | > 25*, @
> "KO" ,, ^
> : 1991+*+- #v_ v
> \ : 1991+*+- #v_v
\ $
^ < <$<</lang>
=={{header|Brat}}==
|