A function is a block of organized, reusable code that is used to perform a single, related action. Functions provide better modularity for your application and a high degree of code reusing. ... Different programming languages name them differently, for example, functions, methods, sub-routines, procedures, etc.