In Ethereum terms, smart contracts are immutable decentralized programs that run deterministically in the context of EVM. They are neither smart nor legal contracts, but the term has stuck.
Smart contracts are usually written in a high-level language like Solidity or Vyper and then compiled to bytecode.
Smart contracts are used to bring real world concepts and value to Ethereum.
Solidity is the main programming language used to write smart contracts for the Ethereum blockchain. It is a statically typed language that looks like C++, JavaScript, and Python.
It is a contract oriented programming language created by Gavin Wood. The main product is a compiler, solc, which converts programs to the EVM bytecode.
Solidity is a statically typed language, supports inheritance, and external libraries. It's a full blown programming language capable of writing sophisticated smart contracts.
All solidity source code should start with a "version pragma" — a declaration of the version of the Solidity compiler this code should use. This is to prevent issues with future compiler versions potentially introducing changes that would break your code.
pragma solidity ^0.5.2;
will compile with a compiler version >=0.5.2 and <0.6.0.
When you have multiple files and you want to import one file into another, Solidity uses the import
keyword.