Define a function

Defining a function that takes 2 integer arguments and returns its sum.

Python

def add(a, b): """Adds a to b""" return a + b

Python with typing annotations

It looks more similar to Rust.

def add(a: int, b: int) -> int: """Adds a to b""" return a + b

Rust

#![allow(unused)] fn main() { /// Adds a to b fn add(a: i32, b: i32) -> i32 { a + b } }