This file contains 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
//Loops | |
//While loop | |
pragma solidity 0.7.5; | |
contract HelloWorld { | |
This file contains 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
//Control Flow (if, else) | |
pragma solidity 0.7.5; | |
contract HelloWorld { | |
// state variables | |
string message ; // message will have the value of _message | |
constructor(string memory _message){ | |
message = _message; | |
} |
This file contains 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
//Pure fonction = that doesn't interact with other state variable | |
//View fonction = that interacts (retrieve) with something else such as state variable but isn't allowed to change the state variable. |
This file contains 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
// JS is an untyped language | |
var a = 1; | |
var b = "Hello"; | |
var c = false; | |
var d = 2.5; | |
// Solidity uses a typed language | |
int a = -1; // int means "signed integer It can be positive and negative nb | |
uint aa = 2; //uint means "unsigned "integer" can only nb >= 0 |
This file contains 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
pragma solidity 0.7.5; | |
contract HelloWorld { | |
function hello() public pure returns(string memory){ | |
return "Hello World"; | |
} |
This file contains 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
import { useState } from "react"; | |
import Item from "./Components/Item/Item"; | |
function App() { | |
const [dataArr, setdataArr] = useState([ | |
{nom: "David" }, | |
{nom: "Burger" }, | |
{nom: "King" }, | |
]); |
This file contains 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
import { useState } from "react"; | |
import Item from "./Components/Item/Item"; | |
function App() { | |
const [toggle, setToggle] = useState(true); | |
const changeState = () => { | |
setToggle(!toggle); | |
}; |
This file contains 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
// Si je veux télécharger la photo et l'avoir dans mes données, je la met dans le dossier du composant en question. Dans cette exmeple | |
//s'agit de "Item". | |
import { useState } from 'react'; | |
import './item.css'; | |
//J'importe la photo à cet endroit | |
import Ethereum from './Ethereum.jpg'; | |
function Item(){ |
This file contains 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
//Le State sont les données de mon composant. |