Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
18
Task/Balanced-brackets/Yabasic/balanced-brackets.basic
Normal file
18
Task/Balanced-brackets/Yabasic/balanced-brackets.basic
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
sub check_brackets(s$)
|
||||
local level, i
|
||||
|
||||
for i = 1 to len(s$)
|
||||
switch mid$(s$, i, 1)
|
||||
case "[": level = level + 1 : break
|
||||
case "]": level = level - 1 : if level < 0 break 2
|
||||
end switch
|
||||
next i
|
||||
return level = 0
|
||||
end sub
|
||||
|
||||
s$ = "[[]][]"
|
||||
|
||||
print s$, " = ";
|
||||
|
||||
if not check_brackets(s$) print "not ";
|
||||
print "ok"
|
||||
Loading…
Add table
Add a link
Reference in a new issue