Created
May 23, 2024 20:17
-
-
Save Husteem/50a43c22e873cd13d040e5de4999369d to your computer and use it in GitHub Desktop.
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.8.0+commit.c7dfd78e.js&optimize=false&runs=200&gist=
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // SPDX-License-Identifier: MIT | |
| pragma solidity 0.8.0; | |
| //fixed arrays | |
| contract arrays { | |
| uint[4] public id = [5, 10, 15, 20]; | |
| function size(uint no, uint new_id) public { | |
| id[no] = new_id; | |
| } | |
| function len()public view returns(uint) { | |
| return id.length; | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // SPDX-License-Identifier: MIT | |
| pragma solidity 0.8.0; | |
| contract booll { | |
| function apple(int figure) pure public returns (bool ) { | |
| bool units = true; | |
| if (figure > 1) { | |
| return units; | |
| } | |
| units = false; | |
| return units; | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // SPDX-License-Identifier: MIT | |
| pragma solidity 0.8.0; | |
| contract constructorr { | |
| uint public size; | |
| constructor (uint newsize) { | |
| size = newsize; | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // SPDX-License-Identifier: MIT | |
| pragma solidity 0.8.0; | |
| contract dynamic_arrays { | |
| uint[] public kano=[4]; | |
| function adder(uint king) public { | |
| kano.push(king); | |
| } | |
| function remover() public { | |
| kano.pop(); | |
| } | |
| function lenth() public view returns (uint) { | |
| return kano.length; | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // SPDX-License-Identifier: MIT | |
| // SPDX-License-Identifier: MIT | |
| pragma solidity ^0.8.0; | |
| contract demo | |
| { | |
| int number; | |
| constructor() { | |
| number = 5; | |
| } | |
| function getter () public view returns (int) | |
| { | |
| return number; | |
| } | |
| function setter() public { | |
| number=number+1; | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // SPDX-License-Identifier: MIT | |
| pragma solidity 0.8.0; | |
| contract functionn | |
| { | |
| int public age = 10; | |
| string public name = "husteemah"; | |
| function adder() public { | |
| age = age+1; | |
| } | |
| function disrupt(int newage, string memory newname)public { | |
| age = newage; | |
| name = newname; | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // SPDX-License-Identifier: MIT | |
| pragma solidity >=0.7.0 <0.9.0 ; | |
| contract demo | |
| { | |
| string public greetings = "Hello World"; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // SPDX-License-Identifier: MIT | |
| pragma solidity 0.8.0; | |
| contract statement { | |
| function cheker(int num) public pure returns ( string memory ) { | |
| string memory answer; | |
| if (num > 0) { | |
| answer = "the input is greater than zero and true"; | |
| } | |
| else if (num ==0) { | |
| answer = "the input is greater than - and les than +"; | |
| } else { | |
| answer = "then input is lesser than zero"; | |
| } | |
| return answer; | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // SPDX-License-Identifier: MIT | |
| pragma solidity 0.8.0; | |
| contract local { | |
| // declearing local variable | |
| function gett () public pure returns (uint) { | |
| uint age = 20; | |
| return age; | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // SPDX-License-Identifier: MIT | |
| pragma solidity 0.8.0; | |
| contract stringg { | |
| string public gm = "hello wor;d"; | |
| function japaneese() public pure returns (string memory) { | |
| string memory gm2= "ohayouuuuuuu"; | |
| return gm2; | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // SPDX-License-Identifier: MIT | |
| pragma solidity 0.8.0; | |
| // states in solidity > stored on chain and exucutes with ether | |
| contract state { | |
| uint public age ; | |
| string public name = "husteemah"; | |
| // constructor () { | |
| // age = 20; | |
| // } | |
| function getter () public { | |
| age= 30; | |
| } | |
| function adder () public { | |
| age = age+2; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment