DEV Community

Cover image for Day 13: Unveiling the Magic of INTRODUCTION in Java, C++, Python, and Kotlin! πŸš€
Nitin-bhatt46
Nitin-bhatt46

Posted on

Day 13: Unveiling the Magic of INTRODUCTION in Java, C++, Python, and Kotlin! πŸš€

DAY - 13
For more Tech content Join us on linkedin click here

All the code snippets in this journey are available on my GitHub repository. πŸ“‚ Feel free to explore and collaborate: Git Repository

Today’s Learning :-

Decimal to Binary

Universal code for decimal to binary. ( cpp, java, python )
Binary to decimal ( cpp, java , python )

Introduction to Function :-
Python:
Theory:
Functions in Python are defined using the def keyword.
They can take zero or more parameters as input and optionally return a value.
Python functions can be defined anywhere in the code, even within other functions.
Python functions can have default parameter values, making some parameters optional.
Python functions can also accept variable-length arguments (*args and **kwargs).

Syntax:

def function_name(parameter1, parameter2, ...):
# Function body
# Statements
return result # Optional return statement

Java:
Theory:
Functions in Java are called methods.
They are defined within classes and objects.
Java methods must specify their return type explicitly, even if it's void (no return value).
Java methods can be static, public, private, etc., to define their accessibility and behaviour.
Java methods can be overloaded, meaning you can define multiple methods with the same name but different parameter lists.
Syntax:

access_modifier return_type method_name(parameter1_type parameter1, parameter2_type parameter2, ...) {
// Method body
// Statements
return result; // Optional return statement
}

C++:
Theory:
Functions in C++ are similar to those in C.
They are standalone entities and can exist outside of classes.
C++ functions can have default parameter values, similar to Python.
C++ supports function overloading, allowing multiple functions with the same name but different parameter lists.
C++ allows you to define inline functions using the inline keyword for small and frequently called functions.
Syntax:

return_type function_name(parameter1_type parameter1, parameter2_type parameter2, ...) {
// Function body
// Statements
return result; // Optional return statement
}

Feel free to reshare this post to enhance awareness and understanding of these fundamental concepts.
Code snippets are in Git repository.

πŸ™ Thank you all for your time and support! πŸ™
Don't forget to catch me daily at 10:30 Am (Monday to Friday) for the latest updates on my programming journey! Let's continue to learn, grow, and inspire together! πŸ’»βœ¨

Top comments (0)