Storing values obtained from for each loop Scala

Scala beginner who is trying to store values obtains in a Scala foreach loop but failing miserably.
The basic foreach loop looks like this currently:

order.orderList.foreach((x: OrderRef) => {
val references = x.ref}))

When run this foreach loop will execute twice and return a reference each time. I'm trying to capture the reference value it returns on each run (so two references in either a list or array form so I can access these values later)

I'm really confused about how to go about doing this...

I attempted to retrieve and store the values as an array but when ran, the array list doesn't seem to hold any values.