# calling variable that holds a previous output.

**URL:** <https://community.wolfram.com/t/calling-variable-that-holds-a-previous-output/2985>\
**Category:** Questions\
**Tags:** software-development\
**Created:** [August 15, 2014, 4:54pm UTC](https://community.wolfram.com/t/calling-variable-that-holds-a-previous-output/2985 "2014-08-15T16:54:51Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![jhvc03](https://yyz1.discourse-cdn.com/wolfram/user_avatar/community.wolfram.com/jhvc03/32/30324_2.png) [@jhvc03](https://community.wolfram.com/u/jhvc03)\
**Post date:** [August 15, 2014, 4:54pm UTC](https://community.wolfram.com/t/calling-variable-that-holds-a-previous-output/2985/1 "2014-08-15T16:54:51Z")

</div>

I have a equation system with two variables. And the Mathematica gives a solution.

How can I call this solution a line down to do another calc.

This question is for automatization process I’m doing.

Solve[x + y == 2 && x - y == 1, {x, y}]  
{{x → 3/2, y → 1/2}}

---

<div class="post-metadata">

**Author:** ![jbaldwin](https://avatars.discourse-cdn.com/v4/letter/j/91b2a8/32.png) [@jbaldwin](https://community.wolfram.com/u/jbaldwin)\
**Post date:** [August 15, 2014, 5:43pm UTC](https://community.wolfram.com/t/calling-variable-that-holds-a-previous-output/2985/2 "2014-08-15T17:43:37Z")

</div>

(\* Original equation \*)  
sol = Solve[x + y == 2 && x - y == 1, {x, y}]

```
(* Use solution for another function of x and y *)
x + 7 y /. Flatten[sol]

```

---

<div class="post-metadata">

**Author:** ![jhvc03](https://yyz1.discourse-cdn.com/wolfram/user_avatar/community.wolfram.com/jhvc03/32/30324_2.png) [@jhvc03](https://community.wolfram.com/u/jhvc03)\
**Post date:** [August 15, 2014, 9:10pm UTC](https://community.wolfram.com/t/calling-variable-that-holds-a-previous-output/2985/3 "2014-08-15T21:10:57Z")

</div>

This is how I save it

sol = Solve[x + y == 2 && x - y == 1, {x, y}];  
x = x /. Flatten[sol]  
y = y /. Flatten[sol]

It says is an error

---

<div class="post-metadata">

**Author:** ![seebonk](https://avatars.discourse-cdn.com/v4/letter/s/f4b2a3/32.png) [@seebonk](https://community.wolfram.com/u/seebonk)\
**Post date:** [August 15, 2014, 10:39pm UTC](https://community.wolfram.com/t/calling-variable-that-holds-a-previous-output/2985/4 "2014-08-15T22:39:20Z")

</div>

You’re missing a semicolon

```
sol = Solve[x + y == 2 && x - y == 1, {x, y}]; x = x /. Flatten[sol]; y = y /. Flatten[sol]

```

Undo the symbol damage with `Clear["x"];Clear["y"];`  
Re-execute and your answers will be OK.
