MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/programming/comments/3uyl7s/daily_programming_puzzles_at_advent_of_code/cxjbzwf/?context=3
r/programming • u/Aneurysm9 • Dec 01 '15
179 comments sorted by
View all comments
Show parent comment
1
the ? is part of the ternary operator (?:)
https://msdn.microsoft.com/en-us/library/be21c7hw(VS.94).aspx
its a nice shorthand for conditionals sometimes. in this case, i wanted to add 1 to my count if the ith member of the string str was equal to '(' and if it was not--since there are only two options '(' vs ')'--i wanted to add -1
View all comments
Show parent comment
1
u/bored_oh Dec 01 '15
the ? is part of the ternary operator (?:)
https://msdn.microsoft.com/en-us/library/be21c7hw(VS.94).aspx
its a nice shorthand for conditionals sometimes. in this case, i wanted to add 1 to my count if the ith member of the string str was equal to '(' and if it was not--since there are only two options '(' vs ')'--i wanted to add -1