Here are guidelines for the Javascript programs used by Brython. PRs that don't follow them will be accepted anyway :-)
indent with 4 spaces
no whitespace at the end of lines
don't end lines with ";" except in cases when it is mandatory
No:
x = "a"; y = "b";
Yes:
x = "a" y = "b"
if(condition)
if (condition)
while(condition){ do_something }
while (condition) { do_something }
}else{
} else {
for (var i = 0;i < 10;i++)
for (var i = 0; i < 10; i++)
if (condition) do_something
if (condition) { do_something }
if (condition) { do_something() }
In this case, one whitespace between the curly braces and the code inside.
if (x<1) { y=0 }
if (x < 1) { y = 0 }
t = {"a":1,"b":2} t = {"a" : 1 , "b" : 2}
t = {"a": 1, "b": 2}
There was an error while loading. Please reload this page.