avatarColleen Sheehy Orme

Free AI web copilot to create summaries, insights and extended knowledge, download it at here

3786

Abstract

arison operators, and bitwise operators on this type too.</p><p id="c4da">It’s important to note that there is another type, called <code>bytes</code> which is different from the above in that it is a dynamically sized array, and not a value type but a reference type. It is basically shorthand for <code>byte[]</code>.</p><p id="ad39">When you can limit the length of your data to a predefined amount of bytes, it is always good practice to use some of <code>bytes1</code> to <code>bytes32</code> because it is much cheaper.</p><h2 id="0118">Enums</h2><p id="aea7"><b>Enums</b> in Solidity are a way to create user-defined types. Enums are explicitly convertible to integer types, but not implicitly. Enum values are numbered in the order they are defined, starting from 0.</p><p id="ed00">Enums are not part of the ABI (Application Binary Interface — more on this in a later lesson, but it’s basically how you encode Solidity code for the Ethereum Virtual Machine, and how you get data back). This means that if your function returns an <code>enum</code> for example, it will be automatically converted to a <code>uint8</code> behind the scenes. The integer returned is just large enough to hold all enum values. With more values, the size gets increased too (<code>uint16</code> and up).</p><p id="cdb6">The below code, taken from the <a href="https://docs.soliditylang.org/en/v0.4.24/index.html">Solidity docs</a>, defines an enum with four possible values, creates a variable of that enum named <code>choice</code> and a constant called <code>defaultChoice</code>that will hold a default value.</p><div id="cf29"><pre><span class="hljs-keyword">enum</span> <span class="hljs-title class_">ActionChoices</span> { GoLeft, GoRight, GoStraight, SitStill } ActionChoices choice; ActionChoices <span class="hljs-type">constant</span> <span class="hljs-variable">defaultChoice</span> <span class="hljs-operator">=</span> ActionChoices.GoStraight;</pre></div><p id="66a9">Now we can define some functions to interact with our <code>enum</code>.</p><div id="c0bb"><pre><span class="hljs-title function_"><span class="hljs-keyword">function</span> <span class="hljs-title">setGoStraight</span></span>() <span class="hljs-keyword">public</span> { choice = ActionChoices.GoStraight; }

<span class="hljs-title function_"><span class="hljs-keyword">function</span> <span class="hljs-title">setChoice</span></span>(ActionChoices <span class="hljs-keyword">new</span><span class="hljs-type">Choice</span>) <span class="hljs-keyword">public</span> { choice = <span class="hljs-keyword">new</span><span class="hljs-type">Choice</span>; }</pre></div><p id="6bc2">The first one simply sets the <code>choice</code> to <code>GoStraight</code> while the second one sets it to the choice that the caller passes into the function. As we can see after deployment, the <code>setChoice</code> function expects a <code>uint8</code> value, which corresponds to the <code>enum</code> value declared at that number.</p><figure id="e997"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*1pKNPVy4UUBCSLi2-SIckg.png"><figcaption>Testing enums in Remix</figcaption></figure><p id="7917">If we want to get the value of <code>choice</code> and <code>defaultChoice</code>, we can define the following functions:</p><div id="1f02"><pre><span class="hljs-keyword">function</span> <span class="hljs-title">getChoice</span>() public view returns (ActionChoices) { <span class="hljs-keyword">return</span> <span class="hljs-type">choice</span>; }</pre></div><div id="43e7"><pre><span class="hljs-function">function <span class="hljs-title">getDefaultChoice</span>() <span class="hljs-keyword">public</span> pure <span class="hljs-title">returns</span> (<span class="hljs-params"><span class=

Options

"hljs-built_in">uint</span></span>)</span> { <span class="hljs-keyword">return</span> <span class="hljs-built_in">uint</span>(defaultChoice); }</pre></div><p id="c2f2">As we can see if we try this out in Remix, the first function returns a <code>uint8</code> while the second returns a <code>uint256</code>.</p><figure id="e514"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*jmaOFb9GhXz7FWC4ONMa_A.png"><figcaption>Testing enums in Remix</figcaption></figure><h2 id="3c7c">Fixed point numbers</h2><p id="2ecc"><b>Fixed point numbers </b>represent fractional numbers by storing a fixed number of digits of their fractional part. No matter how large or small the fractional part is, it will always use the same number of bits.</p><p id="cdcd" type="7">Fixed point numbers are not fully supported by Solidity yet. They can be declared, but cannot be assigned to or from.</p><p id="f872">We can differentiate between signed fixed point numbers, declared with the <code>fixed</code> keyword, and unsigned fixed point numbers, declared with the <code>ufixed</code> keyword.</p><p id="3c1c">It can also be declared as <code>fixedMxN</code> or <code>ufixedMxN</code> where <code>M</code> represents the number of bits the type takes, and <code>N</code> represents the number of decimal points. <code>M</code> has to be divisible by 8 and a number between 8 and 256. <code>N</code> has to be a number between 0 and 80.</p><p id="96e1">They function with the following operators:</p><ul><li>Comparisons: <code><=</code>, <code><</code>, <code>==</code>, <code>!=</code>, <code>>=</code>, <code>></code> (evaluate to <code>bool</code>)</li><li>Arithmetic operators: <code>+</code>, <code>-</code>, unary <code>-</code>, unary <code>+</code>, <code>*</code>, <code>/</code>, <code>%</code> (remainder)</li></ul><h2 id="09b7">Conclusion</h2><p id="bd3a">In this lesson, we looked at what value types are available in Solidity and how each one works.</p><p id="28de">Thank you for staying with us till the end. If you enjoyed reading this piece please keep in touch and follow Solidify to keep up with our lessons on Solidity. In the upcoming articles, we will deep dive into the intricacies of the language, progressing from beginner to advanced level.</p><p id="067c">If you are new to Solidity, check out the previous lessons about setting up a local development environment and writing your first smart contract.</p><div id="6b76" class="link-block"> <a href="https://readmedium.com/how-to-setup-your-local-solidity-development-environment-c4c8195810f3"> <div> <div> <h2>How to Setup Your Local Solidity Development Environment</h2> <div><h3>Get started with smart contract development</h3></div> <div><p>medium.com</p></div> </div> <div> <div style="background-image: url(https://miro.readmedium.com/v2/resize:fit:320/1*HHko-o9m1sVngmTeRVYgKA.jpeg)"></div> </div> </div> </a> </div><div id="3ad1" class="link-block"> <a href="https://readmedium.com/lesson-1-your-first-solidity-smart-contract-1ba7e641f9a3"> <div> <div> <h2>Lesson 1: Your First Solidity Smart Contract</h2> <div><h3>In the previous lesson, we looked at how to set up your local Solidity development environment. Here we will continue…</h3></div> <div><p>medium.com</p></div> </div> <div> <div style="background-image: url(https://miro.readmedium.com/v2/resize:fit:320/1*7r7HSYkbn73NrmR_skvh5w.jpeg)"></div> </div> </div> </a> </div></article></body>

Online Dating is Amazing so Far

I thought it would be scary, but I can’t stop laughing — here’s why

Photo by Andrea Piacquadio: On Pexels

I’m more than a little proud of myself. It took a momentary ‘screw-it’ and a few glasses of Pinot Grigio. But, I did it. I threw myself into the online dating pool.

It’s like man shopping.

In that respect, I’m not sure why I’ve been waiting so long.

I thought online dating would be scary, not hysterical, but I’ll get to that.

A few friends made me a reluctant online dating believer. Although time will truly tell. I recently wrote 3 Friends Have Found Love Online. They’ve met great people that they are still dating.

It’s hard to ignore.

This led to my online dating profile trifecta.

A few glasses of pinot grigio, a ‘screw-it’ moment, and happy friends.

It was enough for me to abandon my apprehensions. I know what you’re thinking. It was the wine, but I’ve had plenty of Pinot Grigio moments. It’s hard to ignore genuine stories of love the second time around. I’m a sucker. They got to me.

I was hesitant because I found online dating scary.

I know I’m not alone.

Likewise, there are plenty who find the word ‘stranger’ exciting.

But I’ve been a relationship columnist for a decade. I exercised my divorce through my column on Beliefnet, contributing to Family Today, and other outlets before Medium. My life is a literal open book. There are no secrets.

The lurking online dating app guy? He’s full of secrets.

I don’t know anything about him.

It doesn’t seem like a fair exchange or Google search.

But I’m over it and committed to giving the proverbial dating app a try.

Full disclosure, I’m still mastering my online dating profile. It’s been less than a week. Hence, the man shopping minus any actual conversations. I’m not just lacking nerve, it turns out there’s a profile learning curve.

Even so, online dating is amazing so far.

Fear has taken a backseat to laughter.

The first 24 hours I had hundreds of likes. Shocking, I know. It wasn’t long before my ego was adjusted and I understood why. I had neglected to enter an age range for potential dates.

I blame the dating app, not the pinot.

I couldn’t decide whether to be creeped out or complimented by the cougar chasing young guys. Fortunately — or unfortunately — whichever way you look at it. My vanity and my online dating profile likes have lowered since I entered an age range for guys.

The laughs didn’t stop, let me count the reasons why.

1. Profile pics

I mean this in the very best way…Men shouldn’t post selfies.

At the very least, stay away from the bathroom mirrors. Long before Anthony Weiner (remember him? NYC former politician) obliterated this shuddersome pose, it was creepy. It’s not the best look.

Now that I’ve got the reflective glass out of the way, let’s talk average selfie.

Super close-up while looking down at the camera. The half-face capture. The intentional ‘look away gaze’ to look less selfie. The blank stare because I don’t know how to take a selfie. The camera in the pic selfie.

None of these is anyone’s best look.

2. The profile props

The only thing that might out shame the selfie is the costume-wearing man.

Maybe there’s an online dating app for gamers or Comic-Con lovers. Who knows. But the general online dating population might be better served if guys announce these interests later or in the bio.

It’s hard to imagine a first date with a grown costume-wearing man.

Or maybe it’s just me.

3. The friends and family

Most women like a social guy, I know I do.

But it’s a dating app so choose your photo-bearing women wisely.

Who exactly is in that picture with you? Is the beautiful woman standing by your side your sister? Your grown daughter? Unless it’s an obvious kid pic or a group pic it’s hard to tell.

Us online dating girls are left to wonder.

Is this guy telling me women can’t resist him? He’s a player? He’s a partying extrovert? He’s still close with his ex? Not sure.

Then there are the buddy pics. Maybe not the best choice for the main profile photo. A girl can’t like your online dating profile if she doesn’t know which man she’s swiping for.

Maybe if there was one pic that identified the man in question.

4. Humor

Humor doesn’t always fly well in a few sentences or less.

I found that out quickly and no one is more attracted to humor than I am.

I can’t resist a funny guy with a great smile. But my laughter was not for the jokes. It was for the fails. There is a seriously limited amount of bio space to prove how funny a guy is. You have to be ridiculously quick-witted to impress on a dating app.

I’ve yet to laugh at any one-liners, and remember I’ve been man shopping.

I had hundreds of likes before I found my age limit controls.

There are the inside jokes that make a guy's buddies laugh hysterically, but left me speechless. There are the actual jokes I had to read multiple times because I thought I must be missing the punchline. I wasn’t.

And worse, there were the women jokes, completely bad form on a dating app. I was married to that. I don’t want to date that. It still gave me a good laugh because it’s not the best way to attract a woman.

A man needs to just say he’s funny in the bio.

I’m not saying I’m a queen or a catch or anything. Or as one online dating guy’s profile said, “I’m not looking for a queen because we did away with royalty years ago.”

Maybe that comment drives home the humor “Danger, Will Robinson” thing.

I’m just having fun with a few observations.

I’m a girl looking to meet a nice guy. I’m not looking to get remarried. I’m not looking for a serious relationship. At least I don’t think I am. I am open to sharing a part of my life with someone or meeting new people.

For now, I’m just grateful for the trifecta.

Pinot Grigio, screw-it, and friends.

I’m warming up to the word ‘stranger’ evolving into the word ‘date.’

Relationships
Self
Culture
Dating
This Happened To Me
Recommended from ReadMedium