# Meaning of double :=

**URL:** <https://techcommunity.softwareag.com/t/meaning-of-double/291904>\
**Category:** Forum\
**Tags:** Adabas-Natural, Natural\
**Created:** [February 21, 2024, 3:32pm UTC](https://techcommunity.softwareag.com/t/meaning-of-double/291904 "2024-02-21T15:32:25Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![pierrev6378](https://avatars.discourse-cdn.com/v4/letter/p/dbc845/32.png) [@pierrev6378](https://techcommunity.softwareag.com/u/pierrev6378)\
**Post date:** [February 21, 2024, 3:32pm UTC](https://techcommunity.softwareag.com/t/meaning-of-double/291904/1 "2024-02-21T15:32:25Z")

</div>

Hi,  
I have a statement like this, does it add var1 and var2 in var\_tot ?  
or var\_tot will be equal to var1 and var2 ?

var\_tot := var1 := var2

As you can see I’m new in Natural  
Thanks in advance !

---

<div class="post-metadata">

**Author:** ![Finn\_the\_Dane1](https://sea1.discourse-cdn.com/techcommunity/user_avatar/techcommunity.softwareag.com/finn_the_dane1/32/132_2.png) [@Finn\_the\_Dane1](https://techcommunity.softwareag.com/u/Finn_the_Dane1)\
**Post date:** [February 21, 2024, 4:35pm UTC](https://techcommunity.softwareag.com/t/meaning-of-double/291904/2 "2024-02-21T16:35:40Z")

</div>

Hi Pierre  
This is simply a way of initializing multiple values with the value furthest to the right  
Try running the example program below to see the result 😉  
There are multiple other more intuitive ways to do this.

1. if the value is zero/blank use RESET
2. if the value is not just zero - say 10 - you can set an init value in the definition and then use RESET INITIAL  
… and probably many more

Finn

```auto
define data local
    1 var1 (I2) init <5>
    1 var2 (I2) 
    1 var_tot (I2)
end-define
var1 := 5
var2 := 10
var_tot := 1
var_tot := var1 := var2 /* initialize all variables with var2
display var_tot var1 var2
reset initial var1
write 'Var1 after reset' var1

END

```

---

<div class="post-metadata">

**Author:** ![Douglas\_Kelly](https://sea1.discourse-cdn.com/techcommunity/user_avatar/techcommunity.softwareag.com/douglas_kelly/32/102_2.png) [@Douglas\_Kelly](https://techcommunity.softwareag.com/u/Douglas_Kelly)\
**Post date:** [February 21, 2024, 7:15pm UTC](https://techcommunity.softwareag.com/t/meaning-of-double/291904/3 "2024-02-21T19:15:59Z")

</div>

Just to be clear: if you want to sum var1 and var2 and put the result in var\_tot, you can use any of these statements:

```auto
VAR_TOT := VAR1 + VAR2
ADD VAR1 VAR2 GIVING VAR_TOT
COMPUTE VAR_TOT = VAR1 + VAR2

```

And Finn has already addressed what the multiple assignment statement does.

---

<div class="post-metadata">

**Author:** ![Jacques72](https://avatars.discourse-cdn.com/v4/letter/j/b5ac83/32.png) [@Jacques72](https://techcommunity.softwareag.com/u/Jacques72)\
**Post date:** [February 22, 2024, 8:20am UTC](https://techcommunity.softwareag.com/t/meaning-of-double/291904/4 "2024-02-22T08:20:02Z")

</div>

Hi,  
I have a statement like this, does it add var1 and var2 in var\_tot ?  
or **var\_tot will be equal to var1 and var2**?

---

<div class="post-metadata">

**Author:** ![Holger\_von\_Thomsen](https://sea1.discourse-cdn.com/techcommunity/user_avatar/techcommunity.softwareag.com/holger_von_thomsen/32/178_2.png) [@Holger\_von\_Thomsen](https://techcommunity.softwareag.com/u/Holger_von_Thomsen)\
**Post date:** [February 22, 2024, 12:00pm UTC](https://techcommunity.softwareag.com/t/meaning-of-double/291904/5 "2024-02-22T12:00:40Z")

</div>

Hi,

If I understood the statement from the original post correctly, it should do the following:  
First var1 is set to value of var2.  
After that, var\_tot will be set to the value of var1, which is equal to value of var2 in this case.

Regards,  
Holger

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/techcommunity/original/3X/c/d/cd19967bb605d28a72d77eb83a1cae22f3df2eb8.svg) [@system](https://techcommunity.softwareag.com/u/system)\
**Post date:** [August 20, 2024, 12:01pm UTC](https://techcommunity.softwareag.com/t/meaning-of-double/291904/6 "2024-08-20T12:01:30Z")

</div>

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.
