From the course: Blockchain: Learning Solidity

Unlock the full course today

Join today to access over 24,700 courses taught by industry experts.

Basic syntax of a contract

Basic syntax of a contract

- [Instructor] Contracts in Solidity are very similar to classes in object-oriented languages. They can contain state variables, functions, events, struct types, and enum types. And as we go through the syntax, we'll explore each one. So let's explore our example that we got started previously and expand on it. So just as a FYI, if you wonder why we're still having an error here, it's because it can't find the file name. We don't have any file name here. So two things you could do. Either you leave as is and you're okay with the error or you can just comment the whole thing and keep the code as an example. At least the file doesn't have that error here. All right, so once we have that, let's go ahead and start building our contract. So what we're going to do in this simple contract first, we're going to state a variable. So let me show you how to do this. And again, I'm going to write a note for all of these so you can…

Contents