0PricingLogin
Blockchain Smart Contracts with Solidity · Lesson

Functions and Visibility Modifiers

Understand how to define functions, manage their visibility (public, private, internal, external), and handle function parameters and return values.

Functions: Your Contract's Actions

Welcome to Lesson 3! Today, we'll dive into functions in Solidity. Think of functions as the actions or operations your smart contract can perform.

They allow you to organize your code, make it reusable, and define how users (or other contracts) can interact with your contract's data and logic.

Defining a Simple Function

Every function needs a name and a body where its code lives. Here's the basic structure:

  • Keyword function
  • Function name (e.g., greet)
  • Parentheses () for parameters
  • Curly braces {} for the code block

Let's see a very simple example.

All lessons in this course

  1. Solidity Data Types and Variables
  2. Control Structures and Loops
  3. Functions and Visibility Modifiers
  4. Structs and Enums
← Back to Blockchain Smart Contracts with Solidity