Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

Are there required naming conventions?

conventions naming
0
0 Posted

Are there required naming conventions?

0
0

In many of the sample files, turnouts are referred to by names like “to12”, signals by names like “si21”, and sensors by names like “bo45”. These conventions grew out of how some older code was written, and they can make the code clearer. But they are in no way required; the program doesn’t care what you call variables. For example, “self.to12” is just the name of a variable. You can call it anything you want, e.g. self.MyBigFatNameForTheLeftTurnout The “self” part makes it completely local; “self” refers to “an object of the particular class I’m defining right now”. Alternately, you can define a global variable, but that’s not recommended. If you have multiple scripts running (and you can have as many as you’d like; we recommend that you put each signal head in a separate one), the variables can get confused if you use the same variable name to mean too different things. Using “self” like this one does makes sure that doesn’t happen. Note that turnouts, etc, do have “System Names” tha

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.

Experts123