[Tutor] escaping newline (was: (no subject))

Alan Gauld alan.gauld at btinternet.com
Tue Mar 17 21:40:42 CET 2009


"A.T.Hofkamp" <a.t.hofkamp at tue.nl> wrote 

> Some people like the following layout
> 
> if long_function_name(a) == long_function_name(b) and \
>    long_function_name(c) == long_function_name(d) and \
>    long_function_name(e) == long_function_name(f):
>     # do something if all three equalities hold
> 
I prefer to use parens for that:

if ( long_function_name(a) == long_function_name(b) and 
     long_function_name(c) == long_function_name(d) and 
     long_function_name(e) == long_function_name(f)  ):
     # do something if all three equalities hold


That increases the indent and avoids the pesky \ chars.
But it adds a hard-to-spot closing paren at the end :-(

-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/l2p/



More information about the Tutor mailing list