Skip to content

Commit 83ad3cc

Browse files
author
James Lockhart
committed
Added tutorial 30
1 parent 06f1d65 commit 83ad3cc

File tree

2 files changed

+38
-0
lines changed

2 files changed

+38
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ The companion to the Youtube tutorials
3232
- [Learning Solidity : Tutorial 27 Getting started with browser development using Metamask](https://www.youtube.com/watch?v=eog2eYrPEu0)
3333
- [Learning Solidity : Tutorial 28 Address book on the blockchain powered by Angular](https://www.youtube.com/watch?v=bvxKICus3bw)
3434
- [Learning Solidity : Tutorial 29 What is WEI and how is Ether defined?](https://www.youtube.com/watch?v=yOfYNUQVjxk)
35+
- [Learning Solidity : Tutorial 30 Gas Explained](https://www.youtube.com/watch?v=sPrYkYk_Beo)
3536
### Support
3637

3738
- [Invalid implicit conversion of arrays from storage to memory and vice-versa](https://github.com/willitscale/learning-solidity/blob/master/support/INVALID_IMPLICIT_CONVERSION_OF_ARRAYS.MD)

tutorial-30/Gas.sol

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
pragma solidity ^0.4.0;
2+
3+
contract Gas {
4+
5+
string[] dataStore;
6+
7+
function cheap(uint a, uint b)
8+
public
9+
pure
10+
returns (uint c)
11+
{
12+
c = a + b;
13+
}
14+
15+
function expensive(string memory val)
16+
public
17+
{
18+
dataStore.push(val);
19+
}
20+
21+
function average()
22+
public
23+
view
24+
returns (string memory)
25+
{
26+
return dataStore[0];
27+
}
28+
29+
function low()
30+
public
31+
pure
32+
returns (string memory)
33+
{
34+
string memory myString = "test";
35+
return myString;
36+
}
37+
}

0 commit comments

Comments
 (0)