How to take input : store in tuple

Suppose we have data structure as tuple:
{box, {width , 15}, {height , 15}}.
Can we take input for width and height and store in the tuple.

2 Likes

Hi,

usually user input/output is done via ‘io’ module. User input can be taken using ‘io:fread/2’. Read the docs about IO at Erlang -- io . There are examples of reading and using the user’s input included.

1 Like

Hello-Thanks
Input may come from keyboard or from a database.
How “io” is done in Erlang , is not the question. How to read into variables and then store the variables (with data) in tuple data structure

1 Like
Box1 = {box, {width , 0}, {height , 0}},
Box2 = setelement(2, Box1, {width, 15}),
Box3 = setelement(3, Box2, {height, 15}),
3 Likes