CyberSlug Rules!

Beginner Programming CMPS060

Prof. Paulo Franca

Home

Syllabus

Login

Objects

Download

Staff only

Scope

Go Slugs!

Will farmers appreciate that?

It is possible to have objects with same names if they are in different scopes. Avoid doing that, if possible!

  • Everytime you open { you start a new scope.
  • Everytime you close } you are back to previous scope.
  • A scope may contain another scope
  • An object is valid only in the scope it is declared
  • If two objects are valid it is understood that the one in local scope is used.

Notice that each function is in a different scope than your main program!