Storing and recalling variables and their values

### 3.3.6 Storing and recalling variables and their values

The archive command stores the values of variables for later use in a file of your choosing.

- archive takes two arguments:
  - filename, a filename in which to store values.
  - vars, a variable or list of variables.
- archive("filename",vars) saves the values of vars (or the values of the variables in the list) in file filename.

For example, if the variable a has the value 2 and the variable bee has the value "letter" (a string), then entering

archive("foo",[a,bee])

will create a file named “foo” which contains the values 2 and "letter" in a format meant to be efficiently read by Xcas.

The unarchive command will read the values from a file created with archive.

- unarchive takes filename, the filename.
- unarchive("filename") returns the value or list of values stored in filename.

#### Example

With the file foo as above:

unarchive("foo")

| ⎡ ⎣ | 2,“letter” | ⎤ ⎦

You can enter

[a,bee]:=unarchive("foo")

in order to reassign these values to a and bee.