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

Jump to navigation Jump to search
m
no edit summary
mNo edit summary
mNo edit summary
Line 268: Line 268:
var waypoint = {number:0,altitude:0,distance:0,angle:0,length:0,ID:0,bearing:0};
var waypoint = {number:0,altitude:0,distance:0,angle:0,length:0,ID:0,bearing:0};
</syntaxhighlight>
</syntaxhighlight>
This is already equivalent to our first example that used a vector to store this waypoint info, the only difference is here that we assign symbolic names (like number, altitude, distance etc) to each field, rather than just a numeric index, as was the case in the vector example.


This adds the following "member fields" to the waypoint hash and sets their initial value to 0:
This adds the following "member fields" to the waypoint hash and sets their initial value to 0:

Navigation menu