Yik Yak icon
Join communities on Yik Yak Download

while(atParty) { try { talkToGirl() } catch { drinkMoreAlcohol() } }

upvote 466 downvote

default user profile icon
Anonymous 145w

Instant syntax error. Possible infinite loop too.

upvote 82 downvote
default user profile icon
Anonymous 145w

shotsTaken = 0 while not drunk: take_shot() shotsTaken += 1 if shotsTaken == 14: drunk = True blackout()

upvote 52 downvote
default user profile icon
Anonymous 145w

ERROR: NO MEMORY ALLOCATION

upvote 27 downvote
default user profile icon
Anonymous 145w

TCP/IP handshake to verify entry into the party

upvote 17 downvote
default user profile icon
Anonymous 145w

while true more like

upvote 11 downvote
default user profile icon
Anonymous 145w

im bad at both coding and getting girls

upvote 11 downvote
default user profile icon
Anonymous 145w

what does catch do? haven’t learned that one yet

upvote 1 downvote
default user profile icon
Anonymous replying to -> #7 145w

I’m just shit at coding have the girlfriend

upvote 5 downvote
default user profile icon
Anonymous replying to -> #11 145w

it catches an exception or error, some languages require to define the class of the exception you are catching.

upvote 5 downvote
default user profile icon
Anonymous replying to -> #11 145w

if anything in the try block throws an error, instead of exiting, the code in the catch block will run. there’s also sometimes a finally block that will run no matter what after the try or catch block.

upvote 2 downvote
default user profile icon
Anonymous replying to -> #11 145w

the concept is usually called ā€œException Handlingā€ if you want to learn more

upvote 3 downvote
default user profile icon
Anonymous replying to -> #2 145w

best comment 😭

upvote 5 downvote
default user profile icon
Anonymous 145w

Your desire for side effects offend me.

upvote 9 downvote
default user profile icon
Anonymous 145w

it does

upvote 3 downvote
default user profile icon
Anonymous replying to -> #15 145w

No it doesn’t?

upvote 3 downvote
default user profile icon
Anonymous replying to -> #13 145w

As the writer of this here algorithm, I made the choice to put the incrementer outside the take_shot function so that my post would be easier to read. It works either way

upvote 3 downvote
default user profile icon
Anonymous replying to -> #2 145w

stack overflow šŸ˜”

upvote 3 downvote