• Skip to main content
  • Skip to primary sidebar

Technipages

Tutorials and fixes for smartphone, gadget, and computer problems

  • Topics
    • Android
    • Browsers
    • Gaming
    • Hardware
    • Internet
    • iPhone
    • Linux
    • macOS
    • Office
    • Reviews
    • Software
    • Windows
    • Definitions
  • Product Reviews
  • Downloads
  • About

Function

August 26, 2019 by Jennifer Spencer

In programming languages, a separate named unit of code that performs a specific calculation or procedure. To use functions, they must be declared in a special area of the program set aside for this purpose.

A function includes placeholders, called logical parameters, that will be replaced by real values (actual parameters) when the function is initiated through a call placed elsewhere in the program.

For example, the following pseudocode adds two numbers and displays the result: add(x, y) {sum = x + y; print sum;} The variables within the parentheses (x, y) are the logical parameters that will be replaced with actual parameters. Elsewhere in the program, a statement such as the following calls and supplies the actual parameters: add(5,10) See actual parameter, call, parameter, parameter passing convention.

Technipages Explains Function

A function in a body of code is an identified smaller piece of code whose position is dependent on the larger body of code. It has a defined role to perform a single specific task. Once a function is written at a point in a program, it is accessible from any part of that same program.

Functions are mainly used because they can be re-used hence save time, functions once they have been declared can be used in as many as possible places and times. Most functions being used, once they have been declared can also be used by other programmers in several different programs. A programmer can compile a list of functions and export them to be used in other programs.

Functions in programming can be traced to the Lambda Calculus system which was developed in the 1930s. Lambda Calculus allows for the provision of a base for evaluating functions and their results. Programming languages that use the Lambda Calculus model are Common Lisp, Scheme, Clojure, Wolfram Language, Racket, and Haskell. Functions in programming are also being utilized by some other programming languages to create a sub-hub in the programming niche for themselves, and examples are XML, SQL, and Lex/Yacc.

Common Uses of Function

  • The main reason a function can be used is that it can be used to avoid repetition of commands within the program
  • Functions and procedures are very similar when functions are initiated, and they return a value, procedures do not.
  • Another reason a function can be used is to help define a logical structure for your program by breaking it into several smaller modules with apparent purposes.

Common Misuses of Function

  • A function even though it’s a defined piece of code  in a much more bigger body of code does not depend on the bigger code
  • Re-usability of a function is highly doubtful as programs do not compile a list of well-known functions.

You Might Also Like

  • Fix: Function Driver Was Not Specified for This Device Instance
    Fix: Function Driver Was Not Specified for This Device…
  • How Does Burp Suite’s Intercept Function Work?
    How Does Burp Suite’s Intercept Function Work?

Primary Sidebar

Recent Posts

  • 3 Ways to Choose All Files in a Folder – Windows 11
  • Apple TV+: How to Erase a Show From the Up Next List
  • How to Change the Profile Picture on Disney+
  • Local Security Policy: What Is It and How to Open It in Windows 11
  • How to Create and Erase an Alarm in Windows 11
  • 10 Best NAS Storage Device for Home and Professional Use
  • PS5 NVMe Requirements You Must Fulfill to Expand PS5 Storage
  • Steam Deck Won’t Turn On: 8 Possible Fixes You Can Try

Who’s Behind Technipages?

Baby and Daddy My name is Mitch Bartlett. I've been working in technology for over 20 years in a wide range of tech jobs from Tech Support to Software Testing. I started this site as a technical guide for myself and it has grown into what I hope is a useful reference for all.

You May Also Like

  • One-Way Hash Function

© Copyright 2023 Guiding Tech Media · All Rights Reserved · Privacy