About Naming Things

Naming Things in BlocklyProp

In BlocklyProp, all variables. functions, and arrays are global, meaning that they can be accessed from any other point in a project at any time.  If you'd like your project to have variables, functions, and arrays, you will need to make up your own names when using these blocks:

variable set

 

array Initialize

 

define function

 

 

The Rules for Naming Things

Following the rules of naming is very important when using these blocks!

  • Use a unique name for each variable, function, and array used in your project.  Do not try to give a function and a variable the same name, for example.
  • Names are case-sensitive, so be consistent with capitalization. To BlocklyProp, foo and Foo are two different names!
  • Make a habit of using letters, numbers, and underscores only. BlocklyProp will replace "illegal" characters, including spaces with underscores. However, in general its good to practice not using illegal characters, as they won't work in C and many other languages. 
  • Begin names with letters only. Names cannot begin with a number; it will cause a compiler error. Do not use underscores at the beginning of names as this may cause conflicts with the names used in BlocklyProp's underlying C code.

You may get a complier error message when you try to run your project if you happen to use name that is the same as a C reserved word. The BlocklyProp system tries to compensate for this by beginning its names with double-underscores, but there are still exceptions that get through and cause trouble.

  • If you see compile error messages that say something like
        "error: 'name' redeclared as different kind of symbol" or
        "note: previous declaration of 'name' was here"
    ...try renaming your variable.