avatarWhite Feather

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>

Repeatedly Mending a Broken Heart

What is the connection between love and music?

As a twelve-year-old boy virgin, Spencer had never kissed a girl, held hands with a girl, shared secrets with a girl, gone on a date with a girl, danced with a girl, and he most assuredly had never been naked with and made love to a girl.

The Sixties were over and so were his pre-pubescent days. The beginning of the Seventies were an opened floodgate through which Spencer was frantically eager to spill forth.

Though he had no girlfriend, Spencer had a transistor radio. His father bought it for him while he was in Japan. He listened for hours each day to the top hits of the day in America. It was an intense time in history to do this. Spencer’s little mind was opened up and his newfound libido erupted like an extinct volcano.

Listening to the popular music of the day, he imagined what it would be like to fall in love. That is what most of the songs were about. Judging by the music, Spencer figured that falling in love must be a truly wondrous experience. He desperately wanted to experience it.

But there were also plenty of songs about broken hearts. There were a plethora of songs that pulled on heartstrings and called forth tears. These were incredibly beautiful songs. What a powerful experience it must be to have a broken heart! This was something Spencer had no experience of.

One of Spencer’s favorite songs at the time was a huge first hit song by an unknown band called, The BeeGees. It was called, How Can You Mend a Broken Heart?

It was such a beautiful song! Spencer would put the ear-plugs from his transistor radio into his ears. He would lock his door, close his eyes and lose himself into the melancholy and sorrow so beautifully expressed.

Yes, Spencer wanted to experience what it was like to fall in love, be in love and touch and hold a female while one of his many favorite love songs was playing in the background. Listening to the music he came so close to feeling the experience but he longed for the genuine article.

But listening to all the ‘broken heart songs,’ he also wanted to experience what it was like to have a broken heart. From the music, it seemed to be an even more intense experience than falling in love. Music compelled him to experience feelings as intensely as possible and the songs showed him that a broken heart was one of the most intense feelings of all.

Technologically, Spencer evolved beyond the transistor radio. Eventually, he got a stereo, a turntable, a cassette player, an 8-track for his car when he was old enough. And then came CDs and walk-mans and eventually the internet.

Spencer’s real-life experiences also evolved. He finally kissed a girl and realized that it felt as good as listening to the very best love song. He fell in love and it felt like he was actually inside one of these songs. He fell in love repeatedly and it was always as intense as the most popular love songs of the time. There was always a corresponding love song at the time of each of Spencer’s infatuations. The American Top 40 lists were an archeological record of his love affairs.

But those lists of popular American music also supplied the requisite broken-heart songs. Every love affair Spencer experienced was followed by a tumultuous break-up. Every eruption of love was followed by a broken heart. There was always a new song waiting to express his grief. He experienced broken heart after broken heart after broken heart. Each time it was as intense as the most powerful recent broken-heart song on the charts.

Eventually, after decades of heart-exploding love experiences and decades of broken hearts, Spencer finally came to the point where he simply stopped listening to music. Completely. Silence became his safe haven.

For a decade Spencer never listened to music. For that same decade he never went on a date with a woman. He never again made love to a woman. He never touched a woman. He never felt the joy of sharing himself with another. He never felt the joy of entering the world of another. For a decade he never touched another human.

And then he came home from work one day. As he fell into his evening routine he realized just how empty his life had become. And he was then compelled to do an internet search for all those songs from his past. He put his headphones on and started listening to music again — for the first time in years. He listened to song after song after song. It was like reading an autobiography. Spencer relived a long lifetime of feelings and emotions and experiences. Simply listening to all those old songs was just like replaying the video tapes of his life. He was re-feeling everything he had ever felt.

How can you mend a broken heart? How can you stop the rain from falling down? How can you stop the sun from shining? What makes the world go round? - BeeGees

Is it love that makes the world go round? Is it love that makes us sing? Is it music that keeps love alive? Is music the by-product of love? Is music what carries love forward? And is it love that leaves a trail of music in its wake?

When we stop listening to music do we stop listening to love? And vice versa?

When we stop listening to music do we stop making music?

Can we make love without making music?

What sounds do we contribute to the universe?

Soon after Spencer began listening to music again he started making music again. Soon that decade of silence became just a moment, a pause between melodies. All great music contains within it brief moments of silence. Silence provides the contrast that emphasizes the musical glory. Every coda is prefaced by anticipatory silence that emphasizes the thunderous conclusion to the love story that leads us to the next love story. And as we listen to the new love story we realize and feel the harmonies that connect all stories and all love.

Music never stops. It is only we who stop listening. It is only we who stop singing. It is only we who stop loving.

How can you mend a broken heart?

Keep singing. That is what Spencer eventually learned. Keep listening. Love leaves a trail of music in its wake as it simultaneously opens us up to new music that compels us to keep moving forward.

And the world keeps going ‘round. Can you hear it? Can you love it? Can you feel it?

Copyright by White Feather. All Rights Reserved. This is a work of fiction.

Music
Short Story
Fiction
Spirituality
Relationships
Recommended from ReadMedium