How to print a prompt in an ion function

I would like to write a typical prompt function in ion where I pass a string and then read some input from the user and return that

in bash I would use something like

function my_prompt () {
echo -n $1
read ret

my_prompt "some prompt "
the_value = $ret

There seems to be no way to do this sort of thing in ion along with not being able to print out debug messages with echo.

Am I missing something

This should work:

fn my_prompt prompt
        echo $prompt
        read x
        echo "You typed" $x

my_prompt "some prompt"

Actually I found this only works if your script isn’t taking input from a pipe. I’m actually stuck trying to get user input in a script that reads from stdin.