Intro to Kotlin (Functions in Kotlin)

in utopian-io •  2 years ago  (edited)

What Will I Learn?

  • You will learn how to write top level functions in Kotlin
  • You will learn how to use default arguments and named parameters in Kotlin
  • You will learn how to create Vararg functions with Kotlin

Requirements

  • The Kotlin Compiler or The Intellij/Eclipse IDE
  • A basic understanding of the JVM as a platform
  • A fair understanding of functions

Difficulty

  • Basic

Description

In this video tutorial, we talk about basic top level functions in Kotlin. Specifically, we cover how we can create functions with or without parameters and return types. We also look at functions that use default arguments and how we can use named parameters to increase code readability and functionality. We look at single expression functions with inferred return types. We also look at Vararg Functions which let us create functions with a variable amount of arguments.

Video Tutorial

Curriculum



Posted on Utopian.io - Rewarding Open Source Contributors

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!
Sort Order:  

Thank you for the contribution. It has been approved.

You can contact us on Discord.
[utopian-moderator]

Thank you as always.

I like the vararg statement. Like you point out in the video, it can be used to drive a loop. Thanks for the look at #Kotlin.

Yeah, variadic functions (varargs) are fairly useful. They also are in the Java language but in my opinion, the Kotlin implementation is a bit better and it feels more optimized.

@tensor, Contribution to open source project, I like you and upvote.

There is no way that you watched my content... You posted this literally 1 minute after I posted this on Utopian.

Congratulations! This post has been upvoted from the communal account, @minnowsupport, by Tensor from the Minnow Support Project. It's a witness project run by aggroed, ausbitbank, teamsteem, theprophet0, someguy123, neoxian, followbtcnews, and netuoso. The goal is to help Steemit grow by supporting Minnows. Please find us at the Peace, Abundance, and Liberty Network (PALnet) Discord Channel. It's a completely public and open space to all members of the Steemit community who voluntarily choose to be there.

If you would like to delegate to the Minnow Support Project you can do so by clicking on the following links: 50SP, 100SP, 250SP, 500SP, 1000SP, 5000SP.
Be sure to leave at least 50SP undelegated on your account.

Hey @tensor I am @utopian-io. I have just upvoted you!

Achievements

  • You have less than 500 followers. Just gave you a gift to help you succeed!
  • Seems like you contribute quite often. AMAZING!

Community-Driven Witness!

I am the first and only Steem Community-Driven Witness. Participate on Discord. Lets GROW TOGETHER!

mooncryption-utopian-witness-gif

Up-vote this comment to grow my power and help Open Source contributions like this one. Want to chat? Join me on Discord https://discord.gg/Pc8HG9x