Add


As we can see - in this case - Perl 6 does not care that you typed in a string, the numeric + adds together the two numbers.

examples/scalars/add.p6
#!/usr/bin/perl6
use v6;

my $a = prompt "First number:";
my $b = prompt "Second number:";

my $c = $a + $b;

say "\nResult: $c";


Copyright 2006, 2007, 2008, 2009, 2010 Gabor Szabo http://szabgab.com/ Index | TOC
If you are interested in on-site trainings by the author, please contact me directly.

Online courses: