22.01.2015 Views

HDevelop User's Manual

HDevelop User's Manual

HDevelop User's Manual

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

66 CHAPTER 3. LANGUAGE<br />

ÖÑ ´ÅÖÙظ ³ÑÖÙسµ<br />

ØÖ×ÓÐ ´ÅÖÙظ ÊÓÒ¸ ½¼¸ ¾µ<br />

Ö× ℄<br />

ÓÖ ÊÙ× ½ ØÓ ¼ Ý ½<br />

ÐØÓÒÖÐ ´ÊÓÒ¸ ÊÓÒÐØÓÒ¸ ÊÙ×µ<br />

ÖÒØÖ ´ÊÓÒÐØÓÒ¸ Ö¸ ÊÓÛ¸ ÓÐÙÑÒµ<br />

Ö×ÊÙ×¹½℄ Ö<br />

ÒÓÖ<br />

Please note that first the variable Ö× has to be initialized in order to avoid a runtime error.<br />

In the example Ö× is initialized with the empty tuple (℄). Instead of Ò×ÖØ the operator<br />

××Ò with tuple concatenation<br />

Ö× Ö׸Ö℄<br />

could be used, because the element is appended at the back of the tuple.<br />

More examples can be found in the program ××ÒºÚ.<br />

3.5.3 Basic Tuple Operations<br />

A basic tuple operation may be selecting one or more values, combining tuples (concatenation)<br />

or reading the number of elements.<br />

ظØ℄<br />

Ø<br />

Ø℄<br />

Ø℄<br />

concatenation of tuples<br />

number of elements<br />

selection of an element<br />

selectionof(apartof)atuple<br />

Table 3.7: Basic operations on tuples<br />

The concatenation accepts one or more variables or constants as input. They are all listed<br />

between the brackets, separated by commas. The result again is a tuple.<br />

Ø ½¸Ø ¾ ℄ is the concatenation of tuple Ø ½ and Ø ¾ .Example:<br />

¸³ÌÜس℄¸º℄℄ ¸³ÌÜس¸º℄<br />

So even the following holds: Ø℄℄ Ø℄ Ø.<br />

Ø returns the number of elements of a tuple. The indices of elements range from zero to the<br />

number of elements minus one (i.e., ع½). Therefore, the selection index has to be within this<br />

range. 2<br />

ÌÙÔРν¸Î¾¸Î¿¸Î℄<br />

ÓÖ ¼ ØÓ ÌÙÔй½ Ý ½<br />

ÛÖØ×ØÖÒ ´ÐÀÒиÌÙÔÐ℄·³Ò³µ<br />

ÒÓÖ<br />

2 Please note that the index of objects (e.g., ×ÐØ ÓØ) ranges from 1 to the number of elements.<br />

<strong>HDevelop</strong> / 2000-11-16

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!