Learn Ethereum Solidity by Sathish Janani
Author:Sathish, Janani
Language: eng
Format: epub, pdf
Published: 2021-08-18T16:00:00+00:00
ENUMS
We are going to cover ENMs I, you know, is a enumerated type. It allows you to quit your own data type and assign names to essentially integer values, a sicker sequential set of integer values. So it's a great way. If, for example, you have some information and you're, and the information is.
Just going up like 0 1, 2, 3, 4 5 6, 7, 8, 9, 10, for example, instead of creating 10 different variables for it. Cause you want to, you know, use that, those numbers again and again, and you just want some sort of name to be some sort of common name they can easily just look at and refer to. He use a E and M to create an email.
Very simple. Just do E numb, like so, and I'll just call it special type. You know, they stopped. This is the name of the inner and open curly braces. And here you just put numbers. I mean, names. So I'm just going to put 1, 2, 3, 4. So there's total of five in here. You could have one, you could have five for 20, could have 30 COVID as many as you want.
So let me just show you something. To actually use it, even though they're essentially numbers, they can't be explained. They can't explicitly be converted to a integer or sign integer on like other programming languages allow you to. So if you wanted to return a special type, okay, this type here, you would change this to special type because that's the data type.
And that was produced. That short type let's say for return one, what will we get so far? Click create, get we get zero my thinking. Okay. Yeah. The return. Anything left you up in the free return to, and I will click create gap is return lawns. So let me try and what do you think. I've got an idea in my head.
Hopefully I'm right. Get full. Remember in computers, pretty much everything starts from zero instead of one. So 0 1, 2, 3, 4, 5. So this first value here is zero. This is one. This is two. If you're free and this is for, so again, like I said, it's just a sequential set of integer values or equivalent of you.
Can't assign this to let's say integer variable, but what you can do is create essay a special type of variable. So we'll call is involve one and involve one. I could assign something to say for Deval one. Equals maybe. Yeah. Well, one that's a doc. Do the, yeah, I could do one equals special type dot four, for example.
And I could just print over one here. So I've been doing well. One. So now, if I were to delete all his old contracts, click create, I click get, he just puts zero because nothing's been assigned to it for click set and then click get it gets free. Cause remember 0 1, 2. So that's it for enumerated types.
Download
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.
Exploring Deepfakes by Bryan Lyon and Matt Tora(7784)
Robo-Advisor with Python by Aki Ranin(7677)
Offensive Shellcode from Scratch by Rishalin Pillay(6132)
Microsoft 365 and SharePoint Online Cookbook by Gaurav Mahajan Sudeep Ghatak Nate Chamberlain Scott Brewster(5077)
Ego Is the Enemy by Ryan Holiday(4968)
Management Strategies for the Cloud Revolution: How Cloud Computing Is Transforming Business and Why You Can't Afford to Be Left Behind by Charles Babcock(4444)
Python for ArcGIS Pro by Silas Toms Bill Parker(4205)
Elevating React Web Development with Gatsby by Samuel Larsen-Disney(3913)
Machine Learning at Scale with H2O by Gregory Keys | David Whiting(3666)
Learning C# by Developing Games with Unity 2021 by Harrison Ferrone(3287)
Speed Up Your Python with Rust by Maxwell Flitton(3235)
Liar's Poker by Michael Lewis(3232)
OPNsense Beginner to Professional by Julio Cesar Bueno de Camargo(3197)
Extreme DAX by Michiel Rozema & Henk Vlootman(3176)
Agile Security Operations by Hinne Hettema(3125)
Linux Command Line and Shell Scripting Techniques by Vedran Dakic and Jasmin Redzepagic(3113)
Essential Cryptography for JavaScript Developers by Alessandro Segala(3084)
Cryptography Algorithms by Massimo Bertaccini(3003)
AI-Powered Commerce by Andy Pandharikar & Frederik Bussler(2990)
