[m-users.] Question about strings

Astrid Garcia mellgarcia0397 at gmail.com
Mon Apr 2 11:13:44 AEST 2018


One part of my project consists on taking as input a number and a string
from the user. Process the number and mod it with 5 and the result will be
the times I will duplicate the string that they input. I got the math part
correct, but I run into problems when I try to read and store the string
and to duplicate it. I am confused as to what is the equivalent on Mercury
of the Java  while loop, the "if (x == 1)" expression and the reading from
user like the "string = input.nextLine();" in Java

Thank you for your help and time,

Astrid Garcia

On Sun, Apr 1, 2018 at 7:23 PM, 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?
>
> Thank you for your time,
>
> Astrid Garcia
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurylang.org/archives/users/attachments/20180401/cc126a78/attachment.html>


More information about the users mailing list