Replicated functions in blueprints?

What if I need it to return a variable at the end? Like “Choose one from this array, delete it from there and give me its reference”?