From the course: Blockchain: Learning Solidity
Unlock the full course today
Join today to access over 24,700 courses taught by industry experts.
Conditionals in Solidity
From the course: Blockchain: Learning Solidity
Conditionals in Solidity
- [Instructor] If you have experience in other languages this will be the easiest part to learn, as Solidity has your typical conditionals: if, for loop, et cetera. The only conditional not available that you may have seen in other languages are switch statements and go to. So let's explore a few. Again, I'm going to clean my screen right here and then I will start with an if statement. (keyboard clicks) And it's very familiar to JavaScript people or any other programming language, it's very, very familiar. So let's say if a equals 2, execute the statement, "execute this code," else, then "execute this code." So if this is true, so if a equals 2, then it will execute this code here. Otherwise execute this code, as simple as this. The next one is for checking the condition first. (keyboard clicks) So basically while, so if you're familiar with while, same thing. If a is larger or equal to zero, then, "execute this…
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
-
-
-
-
Solidity syntax basics5m 31s
-
(Locked)
Basic syntax of a contract5m 52s
-
(Locked)
Types in Solidity6m 31s
-
(Locked)
Units and global variables5m 37s
-
(Locked)
Other special variables2m 37s
-
(Locked)
Functions overview3m 40s
-
(Locked)
Operators in Solidity4m 46s
-
(Locked)
Conditionals in Solidity3m 55s
-
-
-
-