Uppercase or Lowercase in Small Basic

Small Basic language itself is case-insensitive.  So, for example, variable name number and Number are the same.

There is not a clear guidelines about casing in Small Basic so far.  But, for readability of source programs, we should be careful about casing.  And, Small Basic is one of .NET languages.  So, I recommend to use .NET guidelines about naming conventions.

In a TechNet article "Small Basic: Programming Tips" has a description about casing for Variable names.  It says:

There are conventions for variable naming, but most common is to mainly use lower case and capitalise each word apart from the first (that remains lower case).

In Small Basic, we can name for variables, labels, and subroutines.  Following list is my recommendation.

Name for Casing Example
variable Camel prevX
label Pascal RunLoop:
subroutine Pascal OnMouseDown()

 

Camel casing is starting with lowercase, and Pascal casing is starting with uppercase.  Example names above are from "Introducing Small Basic (Get Starting Guide)".

In addition, I'd like to talk about text in Small Basic.  In condition with = (equal) operation, text is case-sensitive.  So, for example, the condition ("number" = "Number") becomes "False".  If you'd like to allow both uppercase and lowercase for input, you will better to use Text.ConverToLowerCase() or Text.ConvertToUpperCase() operations before checking it.  But following cases, the texts are case-insensitive.

  • color names - ex. "LightGray" and "lightgray" are the same
  • array indices - ex. month["October"] and month["OCTOBER"] are the same

See Also

.NET Framework 3.5 | Design Guidelines for Developing Class Libraries | Capitalization Conventions