Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Add

What is the result of this code in Perl / Python / JavaScript / Rust?

fn main() {
    println!("ok");
    println!("{}", "19" + 23);
}
print("ok")
print("19" + 23)

{% embed include file="src/examples/python-types-at-pyweb-2025-05/add.js)

use feature 'say';

say "ok";
say "19" + 23;
rustc add.rs
  • The Rust code will have a compilation error.

  • The Python code will have a runtime exception.

  • The Perl code will print the correct answer: 42.

However, in these example the problem is in-front of us. We can easily see it.