[m-users.] Question about strings
Peter Wang
novalazy at gmail.com
Mon Apr 2 12:43:02 AEST 2018
On Sun, 1 Apr 2018 19:23:48 -0400, Astrid Garcia <mellgarcia0397 at gmail.com> wrote:
> Hi,
>
> I would appreciate help regarding reading input and using it in functions.
> I am working on a program in which I need to read input, store it in a
> variable. How can I do this? and plus how can I declare a function that
> takes a string, a number as input and outputs another string. I created one
> for mod operation "pred modnum(int::in, int::out) is det." how would the
> other function be constructed if it's taking in an int a string and it will
> output a string?
Hi,
You probably want io.read_line_as_string (or similar) and string.to_int
(or similar). An example of their use is here:
https://github.com/Mercury-Language/mercury/wiki/RPN-calculator
Peter
More information about the users
mailing list