Add in function
fn add(x: u32, y: u32) -> u32 { x + y } fn main() { println!("ok"); let first = "19"; let second = 23; println!("{}", add(first, second)); }
def add(x, y):
return x + y
print("ok")
first = "19"
second = 23
print(add(first, second))
use feature 'say';
sub add {
my ($x, $y) = @_;
$x + $y
}
say "ok";
my $first = "19";
my $second = 23;
say add($first, $second);
Much less obvious if we are calling a function with parameters that are not the correct type.
The result is the same as in the previous example.