You can save variable values to a file, to be read later, with the write command. This command takes a string for a file name and a list of variables to save. For example, if a has the value 3.14 and b has the value 7, then
will create a file named “foo” with the contents
If you wanted to store the first million digits of π to a file, you could set it equal to a variable
and then store it in a file
If you want to restore the values of variables saved this way, for example in a different session or if you have purged the variables, then you can use the read command, which simply takes a file name as a string. If, in a different session, you want to use the values of a and b above, the command
will give them the values 3.14 and 7 again. Note that this will silently overwrite any values that a and b might have had.