20,741
edits
mNo edit summary |
mNo edit summary |
||
| Line 77: | Line 77: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
Now, to wrap these fields into a single variable, we could use a Nasal hash. Consider the following empty hash: | Now, to wrap these fields into a single variable that serves as the container for other variables, we could use a Nasal hash. Consider the following empty hash: | ||
<syntaxhighlight lang="php"> | <syntaxhighlight lang="php"> | ||
| Line 98: | Line 98: | ||
* bearing | * bearing | ||
Now, to access any of these fields, we would use the "dot notation" by first specifying the name of the enclosing context (which is really just a fancy word for the name of the hash) and the name of the field we are interested in | Now, to access any of these fields, we would use the "dot notation" by first specifying the name of the enclosing context (which is really just a fancy word for the name of the hash) and the name of the field we are interested in: | ||
<syntaxhighlight lang="php"> | <syntaxhighlight lang="php"> | ||
| Line 110: | Line 110: | ||
print ( waypoint.bearing ); | print ( waypoint.bearing ); | ||
</syntaxhighlight> | </syntaxhighlight> | ||
Now, to make this is a little more interesting and to show what's happening, we are going to change the value of each field: | Now, to make this is a little more interesting and to show what's happening, we are going to change the value of each field: | ||