Crypto Zombies Lesson 2, Chapter 7, Storage vs Memory

Channel:
Subscribers:
8,020
Published on ● Video Link: https://www.youtube.com/watch?v=PPQ9PLpSOAA



Duration: 6:25
422 views
7


In this CryptoZombies tutorial we look at the difference between storing variables in storage or keeping them temporarily in memory. We learn that by default, Solidity variables outside of functions are considered state variables and will therefore be storage. This means variables outside of functions are by default permanently written to the blockchain. Variables that are within functions will disappear after the function call is over. Once the function call ends Solidity clears those variables from memory, like RAM in a computer. In this challenge we create a function called feedAndMultiply which takes 2 parameters. Both are uints, one is our _zombieId and the other is _targetDna. We then make sure that zombie belongs to that zombieOwner which called the function. Finally we get the zombies DNA by creating a local Zombie named myZombie which we set equal to the _zombieId i the zombes array.




Other Videos By We Will Code


2018-06-25Question App in Nodejs, Express, Flash Card App with Pug Templating
2018-06-22Codecademy's Learn Express, Matching Longer Paths, ExpressJS
2018-06-21Codecademy's Learn Express, Setting Status Codes
2018-06-19Codecademy's Learn Express, Getting a Single Expression
2018-06-18Codecademy's Learn Express, Matching Route Paths, Understanding Express JS
2018-06-15Codecademy's Learn Express, Sending a Response, Nodejs Backend
2018-06-14Codecademy's Learn Express, Writing Your First Route
2018-06-13Codecademy's Learn Express, Starting a Server, Back-End Apps
2018-06-13Learn Express JS, Back-End Programming Tutorial, Codecademy
2018-06-09Crypto Zombies Lesson 2, Chapter 8, Zombie DNA, Solidity DApp
2018-06-03Crypto Zombies Lesson 2, Chapter 7, Storage vs Memory
2018-06-01Crypto Zombies Lesson 2, Chapter 6, Import, Imports in Solidity
2018-05-27An Intro to Coding, Codecademy's Welcome To Codecademy Tutorial, Codecademy Starter Kit
2018-05-13Crypto Zombies Lesson 2, Chapter 5, Inheritance, Solidity Walkthrough
2018-05-11Crypto Zombies Lesson 2, Chapter 4, Require, Solidity Require Statements
2018-05-10Crypto Zombies Lesson 2, Chapter 3 Msg.sender, Solidity Language
2018-05-06Crypto Zombies Lesson 2, Chapter 2 Mappings and Addresses
2018-05-06Codecademy Learn Java, Data Structures Generalizations
2018-05-02Crypto Zombies, Chapter 2 Overview,Solidity Programming
2018-05-02Codecademy Learn Java, HashMap Access, Accessing a HashMap
2018-04-28Crypto Zombies Lesson 1 ,Ch14 Web3.js, Solidity Events



Tags:
Solidity tutorial
solidity memory
solidity storage
cryptozombies
crypto zomibes tutorial