logo

Solidity by Example
version 0.8.3

Hello World

pragma specifies the compiler version of Solidity.

// SPDX-License-Identifier: MIT
// compiler version must be greater than or equal to 0.8.3 and less than 0.9.0
pragma solidity ^0.8.3;

contract HelloWorld {
    string public greet = "Hello World!";
}

Try on Remix

Take a course at Smart Contract Engineer