-Get Parameters Values.. index::
+.. index::
single: Declarative Programming; Introduction
===============================================
* Executing code after the end of object access
* Declarative Programming on the top of Object-Oriented
-Get Parameters Values.. index::
+.. index::
pair: Declarative Programming; Objects inside lists
Creating Objects inside Lists
Example:
-Get Parameters Values.. code-block:: ring
+.. code-block:: ring
alist = [new point, new point, new point] # create list contains three objects
Output:
-Get Parameters Values.. code-block:: ring
+.. code-block:: ring
Item 4 is a list contains 3 items
1
y: 150.000000
z: 250.000000
-Get Parameters Values.. index::
+.. index::
pair: Declarative Programming; Return object by reference
Composition and Returning Objects and Lists by Reference
The same is done also if the attribute is a list (not object).
-Get Parameters Values.. note:: Objects and Lists are treated using the same rules. When you pass them to function they are passed by reference,
+.. note:: Objects and Lists are treated using the same rules. When you pass them to function they are passed by reference,
when you return them from functions they are returned by value except if it's an object attribute where a return by reference
will be done.
Example:
-Get Parameters Values.. code-block:: ring
+.. code-block:: ring
o1 = new Container
myobj = o1.addobj() # the assignment will create another copy
Output:
-Get Parameters Values.. code-block:: ring
+.. code-block:: ring
x: 10.000000
y: 20.000000
Example(2):
-Get Parameters Values.. code-block:: ring
+.. code-block:: ring
func main
o1 = new screen {
Output:
-Get Parameters Values.. code-block:: ring
+.. code-block:: ring
x: 100.000000
y: 200.000000
Example(3):
-Get Parameters Values.. code-block:: ring
+.. code-block:: ring
func main
o1 = New Screen {
Output:
-Get Parameters Values.. code-block:: ring
+.. code-block:: ring
x: 100.000000
y: 200.000000
z: 250.000000
-Get Parameters Values.. index::
+.. index::
pair: Declarative Programming; executing code after the end of object access
Executing code after the end of object access
Example:
-Get Parameters Values.. code-block:: ring
+.. code-block:: ring
New Point { See "How are you?" + nl }
Output:
-Get Parameters Values.. code-block:: ring
+.. code-block:: ring
How are you?
I'm fine, Thank you!
-Get Parameters Values.. index::
+.. index::
pair: Declarative Programming; Declarative programming on the top of Object-Oriented
Declarative Programming on the top of Object-Oriented
Example:
-Get Parameters Values.. code-block:: ring
+.. code-block:: ring
# Declarative Programming (Nested Structures)
Output:
-Get Parameters Values.. code-block:: ring
+.. code-block:: ring
x: 100.000000
y: 200.000000
z: 250.000000
I have 2 points!
-Get Parameters Values.. index::
+.. index::
pair: Declarative Programming; More Beautiful Code
More Beautiful Code
Example:
-Get Parameters Values.. code-block:: ring
+.. code-block:: ring
new Container
{
Output
-Get Parameters Values.. code-block:: ring
+.. code-block:: ring
3D Point
10