Functions
Functions are, like building blocks of code that can be reused to accomplish tasks. They play a role in organizing code making it easier to read and maintain. When defining a function you enclose a set of instructions within braces. You can also specify parameters (inputs). Return values (outputs).
#include <iostream>
// Function declaration
void greet() {
std::cout << "Hello, w3wiki!" << std::endl;
}
int main() {
// Calling the function
greet();
return 0;
}
#include<stdio.h>
// Function declaration
void greet() {
printf("Hello, w3wiki!\n");
}
int main() {
// Calling the function
greet();
return 0;
}
public class FunctionExample {
// Function declaration
static void greet() {
System.out.println("Hello, w3wiki!");
}
public static void main(String[] args) {
// Calling the function
greet();
}
}
# Function definition
def greet():
print("Hello, w3wiki!")
# Calling the function
greet()
// Function declaration
function greet() {
console.log("Hello, w3wiki!");
}
// Calling the function
greet();
Output
Hello, w3wiki!
How to Start Coding
In this ever-evolving digital landscape, the ability to code is not just a valuable asset but a gateway to creative expression and innovation. This brief guide will outline practical steps and essential principles to guide aspiring learners on their path to mastering the art of coding.
Table of Content
- Introduction, to Basic Syntax. Hello World
- Understanding Data Types
- Variables and Constants
- Keywords
- Operators
- Decision Making statements
- Loops
- Numbers
- Characters
- Arrays
- Strings- Basic String Concepts
- Functions
Contact Us