How to maximize business value with awesome UX design

Major advancements in website services and technologies have made launching a website easier than ever, however, optimizing a site for user experience (UX) is a whole other game. UX design is more…

Smartphone

独家优惠奖金 100% 高达 1 BTC + 180 免费旋转




Functions Part I

Hello and welcome back. In this post I’ll be introducing FUNCTIONS and in the next post after this one we’ll take a deeper dive into how functions work.

As always, different computer languages do things in different ways and with different syntax but the concept of functions is universal:

FUNCTIONS are self-contained blocks of code which may or may not take input and then run to arrive at a value. They bear some similarity to factories because they can take some type of input and produce some type of output.

Functions allow you to reuse blocks of code without having to write every single step of the process each time you use it. Therefore they are great to use when you have a commonly repeated task.

Let’s say that you’re cooking breakfast for your friends and you want to make 10 omelettes. The steps to make one omelette would look something like:

Writing this process enough times to make 10 omelettes would be a fairly lengthy set of instructions. However, if we make “COOK OMELETTE” a function, we can call that function until we get as many omelettes as we want or need. As a side note, when we say “call” a function it means we’re telling the function to run.

Making the “Cook Omelette” function turns this

…into this…

Declaring a function once and then repeating a function call as needed is a very important concept. When learning about programming you will hear the acronym DRY, which stands for don’t repeat yourself. Not only will you save yourself from having to write many lines of extra code, if you do have to change a function you’ll only have to do it once instead of every single time it appears in your code and this will really cut down on the chance of making mistakes and having bugs in your program.

SUMMARY AND CALL TO ACTION

Functions “encapsulate” code meaning that they essentially combine multiple lines of code in order to perform a specific task. That code is then easily repeatable and can be used throughout your program so you don’t have to repeat yourself.

Thanks for reading, remember to like and subscribe, and in the next post I’ll explain how functions take input with PARAMETERS.

Add a comment

Related posts:

Grape seeds

Benefits of Grape Seeds for Health Grape seeds are packed with nutrients that can benefit your health in a variety of ways. They are rich in antioxidants that protect your cells from damage and can…

BLOCKCHAIN WITH CIBUS AND FOOD SECURITY

Confidence is a standout amongst the most imperative parts of a business. confidence originates from straightforwardness and finish trustworthiness, with CIBUS individuals will now have a stage on…

Hope for a world of despair

Found the following beautiful words from Kitty O’Meara on the web, and hope it will bring some of you some hope and inspiration: “And the people stayed home. And read books, and listened, and rested…