Anonymous
Not logged in
Talk
Contributions
Create account
Log in
WikiKnowledgeBase
Search
Editing
Technology/Software Development/General knowledge/Programming Fundamentals/Functions
(section)
From WikiKnowledgeBase
Namespaces
Page
Discussion
More
More
Page actions
Read
Edit
History
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
== Functions == '''Definition''' A function is a self-contained block of code that performs a specific task or calculates a value. It takes in inputs, known as parameters or arguments, and returns an output. Functions allow you to break down complex problems into smaller, manageable tasks, promoting code reuse and modularity. '''Function Declaration and Execution''' To use a function, you need to declare it and then call or execute it when needed. '''Code Example''' Here's an example in Python that demonstrates the declaration and execution of a function: <pre> # Function declaration def greet(name): print("Hello, " + name + "!") # Function execution greet("John") </pre> In this example, we declare a function named `greet` that takes in a parameter `name`. When the function is executed with the argument `"John"`, it will print `"Hello, John!"` to the console.
Summary:
Please note that all contributions to WikiKnowledgeBase may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
My wiki:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Navigation
Navigation
Main page
Random page
Categories
Help about MediaWiki
Wiki tools
Wiki tools
Special pages
Page tools
Page tools
User page tools
More
What links here
Related changes
Page information
Page logs