Let's begin with the most basic smart contract example,  HelloWorld.sol, shown as follows:
pragma solidity ^0.4.24;
contract HelloWorld {
string public greeting;
constructor() public {
greeting = 'Hello World';
}
function setNewGreeting (string _newGreeting) public {
greeting = _newGreeting;
}
}
Solidity's file extension is .sol. It is similar to .js for JavaScript files, and .html for HTML templates.