# Write statement in a Gauss code

Hi,

I was given a code that has different version of the following in several parts of it:

```if write;
format /rd 8,4;
"mean reversion matrix phi (feedback form)" inv(sigma)*phi*sigma;
print;
"conditional factor variance" (dscale^2)*condvar;
print;
"unconditional factor variance" (dscale^2)*ucondvar;
print;
endif;
```

and also "write" is included as an input in the procedure where this commands are included.

I'm not really sure if this is used just to print results or for something else.

Can you help me with this?

0

accepted

Many thanks!

0

In GAUSS, statement evaluations that are not assigned to anything are implicit print statements. For example, the statement:

```print 5+5;
```

and the statement:

```5+5;
```

will both print the result of the expression, which in this case is 10. You can add strings on the same line as these print statements (implicit or explicit) and they will also print. For example:

```print "Five plus five = " 5+5;
```

will return:

```Five plus five = 10.000
```

The code snippet you provided contains only these types of print statements, there are no assignments. Your guess is correct that it is just printing results.

Since write is an input to a procedure, it is most likely just a scalar value that turns these print statements on and off.

aptech

1,773

0
accepted

Many thanks!

0

In GAUSS, statement evaluations that are not assigned to anything are implicit print statements. For example, the statement:

```print 5+5;
```

and the statement:

```5+5;
```

will both print the result of the expression, which in this case is 10. You can add strings on the same line as these print statements (implicit or explicit) and they will also print. For example:

```print "Five plus five = " 5+5;
```

will return:

```Five plus five = 10.000
```

The code snippet you provided contains only these types of print statements, there are no assignments. Your guess is correct that it is just printing results.

Since write is an input to a procedure, it is most likely just a scalar value that turns these print statements on and off.

### Have a Specific Question?

Get a real answer from a real person

### Need Support?

Get help from our friendly experts.