Is there an Electric Imp style guide for Squirrel?

Is there an in-house style guide for Squirrel? There are various ways to place curly brackets, indents, upper and lowercase variables, variables starting with underscores, etc, none of them more right or wrong than the other AFAIK.

If there’s a Squirrel style guide used internally at Electric Imp then I’d like to use that too.

I would suggest you write it the way it works for you. Me, I place opening braces on a new line because IMHO it’s neater and helps make the structure of the nested code more clear, but many of my Imp colleagues prefer it the other way.

Ditto semicolons. I’ve given up adding these to my code because Squirrel doesn’t mandate them the way other languages do. But, again, other Imp folk prefer to put them in because that’s what they’re accustomed to.

I think the crucial point above all others is that code is readable and readily understandable, either for other people or for you if you come back to a listing some months down the line. So, comment your code will and use clear variable names (they don’t have to be long). The rest, though, should be what you prefer.

If you’re contributing to the Electric Imp public GitHub Repo, we do ask that your structure your code and files in a certain way, however. You can read up on the details here.