Programming: newline in rhs expression: Python vs JavaScript

Self-tutoring about programming: the tutor mentions a difference between Python and JavaScript he’s noticed.

With Python, if you want to continue to the next line (perhaps for easier reading), it seems a backslash, then Return, will work:

the_var= (3 + 4 \
+5) #Python

JavaScript seems to allow it with just Return:

the_var = (3 + 4
+5) //JavaScript

Jack of Oracle Tutoring by Jack and Diane, Campbell River, BC.

Leave a Reply