# Storing and recalling variables and their values: archive unarchive

### 4.4.6 Storing and recalling variables and their values: archive unarchive

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 one argument:
  filename, the filename.
- unarchive("filename") returns the value or list of values stored in filename.

#### Example.

With the file “foo” as above:
Input:

unarchive("foo")

Output:

⎡ ⎣ | 2,"letter" | ⎤ ⎦

If you want to reassign these values to a and bee, you can enter

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