Howto:Start using vectors and hashes in Nasal: Difference between revisions

Jump to navigation Jump to search
m
correction
(+- first section)
m (correction)
Line 5: Line 5:
In many cases repetitive code can be generalized and rewritten into vectors, hashes or helper functions using them.  Some of the advantages with rewriting repetitive code this way is that it helps maintenance by requiring less typing when modifying and/or when fixing bugs.
In many cases repetitive code can be generalized and rewritten into vectors, hashes or helper functions using them.  Some of the advantages with rewriting repetitive code this way is that it helps maintenance by requiring less typing when modifying and/or when fixing bugs.


In addition to storing data hashes can "store" functions and be used as object classes.  Object classes can be created by adding a function into a hash, that will create a new hash when called, a so called ''creator'' (sometimes abbreviated to ''c'tor'') usually named <code>'''new'''()</code>.
In addition to storing data hashes can "store" functions and be used as object classes.  Object classes can be created by adding a function into a hash, that will create a new hash when called, a so called ''constructor'' (sometimes abbreviated to ''ctor'' or ''c'tor'') usually named <code>'''new'''()</code>.


== Learn more about vectors ==
== Learn more about vectors ==

Navigation menu