in reply to Re: perl6: problem with prompt
in thread perl6: problem with prompt

i have tried your suggestion:
my $num = prompt("Please write a number : "); say $num.PARROT; $num +=3; say $num.PARROT;
the result is this:
String
Num

it gives the same result whether the number below 10 or more
regards

Replies are listed 'Best First'.
Re^3: perl6: problem with prompt
by moritz (Cardinal) on Jun 06, 2010 at 10:05 UTC
    Can you please also try it with a current development version of Rakudo?
      i have downloaded randomly a previous version; it is
      setup-parrot-1.7.0.exe
      setup-parrot-1.7.0-rakudo-22.exe
      and yes it is working okay with any number
      also i have tried the previous version 2.3.0 and it gives error results like 2.4.0
      sorry moritz, i have'nt the tools to build it, it needs a c compiler,
      regarding the above example: in the domain of negative numbers the results is correct for any numbers
      such as entering number -7 will give the results
      -7
      -4

      thanks
      Hi
      after a lot of trials i have succeeded in installing the latest rakudo from source on windows xp, the above problem is the same, it seems prompt function adds additional letter to the right of the one digit number ,
      i can get around such behaviour with this code until the problem resolved in future releases:
      use v6; my $num = prompt("Please write a number : "); if $num.chars == 2 {$num = substr $num, 0, 1;} say $num; $num +=3; say $num;
      regards