Copy the return value of a function to the clipboard

I have a function that returns a string, how can I make it so that when the function terminates the result is automatically copied to the clipboard (ctrl + c)? Thank you.

You can use clipboard

function foo()
    s = "copy this"
    clipboard(s)
end
3 Likes