Example 5 - Inference Type inference is a powerful tool that allows your programs to be more concise and readable, all while maintaining type safety. This example does not compile and run because there are deliberate compiler errors in it to demonstrate type inference.