Even Numbers Filter - Solidity Typing CST Test
Loading…
Even Numbers Filter — Solidity Code
Returns even numbers from an array.
pragma solidity ^0.8.0;
contract EvenNumbers {
uint[10] public nums = [1,2,3,4,5,6,7,8,9,10];
uint[] public evens;
function filter() public {
delete evens;
for(uint i=0;i<nums.length;i++) {
if(nums[i] % 2 == 0) {
evens.push(nums[i]);
}
}
}
}Solidity Language Guide
Solidity is a statically typed, contract-oriented programming language designed for building smart contracts on the Ethereum blockchain. It enables developers to write decentralized applications (dApps), manage digital assets, and automate trustless logic using a syntax inspired by JavaScript, C++, and Python.
Primary Use Cases
- ▸Smart contract development
- ▸DeFi protocols (DEXs, lending, staking)
- ▸NFT standards (ERC-721, ERC-1155)
- ▸Token creation (ERC-20)
- ▸DAO governance mechanisms
- ▸Permissioned enterprise blockchain apps
Notable Features
- ▸Contract-oriented design
- ▸Strong static typing
- ▸Events for EVM logs
- ▸Function modifiers
- ▸Library & inheritance support
Origin & Creator
Solidity was created by Gavin Wood and the Ethereum Foundation in 2014 to serve as the primary language for writing smart contracts on the Ethereum blockchain.
Industrial Note
Solidity is heavily used in decentralized finance (DeFi), NFT marketplaces, blockchain gaming, DAOs, tokenization engines, supply chain tracking, on-chain governance, and enterprise blockchain automation.