Skip to content

Commit

Permalink
Solves some warnings.
Browse files Browse the repository at this point in the history
  • Loading branch information
Caul58 committed Mar 23, 2024
1 parent a2ae627 commit 85486b8
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ func isBalanced(expression: String) -> Bool {
var symbolStack: [Character] = []
let openSym: [Character] = ["{", "[", "("]
let closeSym: [Character] = ["}", "]", ")"]
var exit = false

for symbol in expression {
if openSym.contains(symbol) {
symbolStack.append(symbol)
} else if closeSym.contains(symbol) {
if !symbolStack.isEmpty, symbolStack.last == openSym[closeSym.firstIndex(of: symbol)!] {
symbolStack.popLast()
let _ = symbolStack.popLast()
} else {
return false
}
Expand Down

0 comments on commit 85486b8

Please sign in to comment.