From the course: Building an Ethereum Blockchain App: 7 Smart Contracts
Unlock this course with a free trial
Join today to access over 25,300 courses taught by industry experts.
Solidity data modifiers, part 2 - Ethereum Tutorial
From the course: Building an Ethereum Blockchain App: 7 Smart Contracts
Solidity data modifiers, part 2
- Okay, so now we're back in VS Code. We're looking at our data type .sol smart contract, and I've added a little bit to it. So you'll notice there's a new function at the very bottom. We did have a function, getStateVariables, this is a public function, and we see that from the public keyword right here. So what this does is it does several things, the public keyword, and by the way, there's another keyword, another modifier we haven't talked about view. View tells us, or tells the compiler, actually, that the body of my function will only reference local variables, in other words, I'm not touchin the blockchain. We do that to save costs, we save gas and we also can do that to help the compiler keep us honest because now if I go into my function and I try to write code that interacts with the blockchain, the compiler is going to say, "Nope, not going to let it happen," and gives me a nasty error message, not a warning, but…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
Smart contracts review2m 56s
-
(Locked)
What is the supply chain?6m 57s
-
(Locked)
Supply chain challenges and blockchain solutions6m 58s
-
Blockchain solution examples4m 4s
-
(Locked)
Ethereum tokens6m 25s
-
(Locked)
Supply chain project8m 18s
-
Exploring solidity11m 12s
-
(Locked)
Defining types of data4m 37s
-
(Locked)
Data types8m 50s
-
(Locked)
Solidity data modifiers, part 14m 4s
-
(Locked)
Solidity data modifiers, part 25m 40s
-
(Locked)
Revisiting gas6m 8s
-
(Locked)
Controlling flow12m 29s
-
(Locked)
Handling errors5m 12s
-