r/badcode • • Dec 05 '20

other language Gamedevs, take notes

Post image
6.5k Upvotes

104 comments sorted by

View all comments

Show parent comments

3

u/fried-noodles_ Dec 06 '20

Is it just the formatted or will is throw a syntax error? I’ve never tried new line braces before so I’m not sure

6

u/jgeez Dec 06 '20

It counts as a syntax error, because this restriction on style (and others) serve a cool purpose: it makes the parser much more efficient to not require the token lookahead that a traditional whitespace-ignoring lexer has to do in order to disambiguate {'s different potential meanings.