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.

64 CHAPTER 3. LANGUAGE<br />

¯ If one of the tuples is of length one, all elements of the other tuples are combined with that<br />

single value for the chosen operation.<br />

¯ If both tuples have a length greater than one, both tuples must have the same length (otherwise<br />

a runtime error occurs). In this case, the selected operation is applied to all elements<br />

with the same index. The length of the resulting tuples is identical to the length of the<br />

input tuples.<br />

¯ If one of the tuples is of length 0 (℄), a runtime error occurs.<br />

In table 3.6 you can find some examples for arithmetic operations with tuples. In this example<br />

Input<br />

<br />

℄ ℄<br />

½¸¾¸¿℄ ¾<br />

½¸¾¸¿℄ ¾º½ · ½¼<br />

½¸¾¸¿℄ ½¸¾¸¿℄<br />

½¸¾¸¿℄ ½¸¾℄<br />

³ÌÜؽ³ · ³ÌÜؾ³<br />

½º¾¿ · ³ ÌÜس<br />

³ÌÜؽ ³ · · ³ ÌÜؾ³<br />

³ÌÜØ ³ · ¿º½ ¾<br />

¿º½ ´¾ · ³ ÌÜسµ<br />

¿º½ · ¾ · ³ ÌÜس<br />

¿º½ · ´¾ · ³ ÌÜسµ µ<br />

³ÌÜØ ³ · ¾º½ · ¿<br />

Result<br />

¾<br />

¾<br />

¾¸¸℄<br />

½¾º½¸½º¾¸½º¿℄<br />

½¸¸℄<br />

runtime error<br />

³ÌÜؽÌÜؾ³<br />

³½º¾¿ ÌÜس<br />

³ÌÜؽ ÌÜؾ³<br />

³ÌÜØ º¾³<br />

runtime error<br />

³º½ ÌÜس<br />

³¿º½¾ ÌÜس<br />

³ÌÜØ ¾º½¿³<br />

Table 3.6: Examples for arithmetic operations with tuples and strings<br />

you should pay special attention to the order in which the string concatenations are performed.<br />

3.5.2 Assignment<br />

In <strong>HDevelop</strong>, an assignment is treated like an operator. To use an assignment you have to select<br />

the operator ××Ò ´ÁÒÔÙظ Ê×ÙÐص. This operator has the following semantics: It<br />

evaluates ÁÒÔÙØ (right side of assignment) and stores it in Ê×ÙÐØ (left side of assignment).<br />

However, in the program text the assignment is represented by the usual syntax of the assignment<br />

operator: ’’. The following example outlines the difference between an assignment in<br />

C syntax and its transformed version in <strong>HDevelop</strong>:<br />

The assignment in C syntax<br />

Ù ×Ҵܵ · Ó״ݵ<br />

is defined in <strong>HDevelop</strong> using the assignment operator as<br />

××Ò´×Ҵܵ · Ó״ݵ¸ Ùµ<br />

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

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

Saved successfully!

Ooh no, something went wrong!