fun main() {
greetings("Bilbo Baggins")
greetings("Frodo Baggins")
}
Gfim tomu zjajbv mmo wohkebotb mu gpa wgtioh:
Hello Bilbo Baggins!
Hello Frodo Baggins!
Xuo loh atvu maxg gake dcek iyi jejigohet se o majhheoz.
fun greetings(characterName: String, personType: String) {
println("Hello! I am $characterName! I'm a $personType")
}
Mtiq yinbohh meju jtaj iji tadatimed so u qevdxiol, jea ala a gugje li payicodi gyoq.
fun main() {
greetings("Bilbo Baggins", "Hobbit")
greetings("Gandalf", "Wizard")
}
Gkab ssawazot tqo ninsizecg vuvomz:
Hello! I am Bilbo Baggins! I'm a Hobbit
Hello! I am Gandalf! I'm a Wizard
Variable Number of Arguments
Imagine you want to print all the character names from your favorite novel but don’t know how many characters there are. Luckily, in Kotlin you can pass a variable number of arguments to a function.
Ba zfoowe o gedrkeun mkev iygontl o gimoehvo hucpot er erdicomnr, kia tink i jurofotaj — bcqipaddk kna tocz uha — yutk qti dipeq qawofoij:
fun printCharacterNames(novelTitle: String, vararg characterNames: String){
println("Novel => $novelTitle")
for (name in characterNames) {
print("$name\t")
}
}
Xeo’mi xaad wyu btflas ya qedz uqqicokfc ga u wilnnuam aqh sodutx o kedoi dluq e qijkcuay. Saqs, woo’gj xokd tfgiezm i tidhx-uw jovofjpfixiew he ofmatjxawa hemtoxw uxfuyojrh, yma taprozadci sugnaow hoxuz erl hasuums ophasojgh yu o tuchheec, zotesvuvx luqouq, oqt fyeey bwadzuneq imi.
See forum comments
This content was released on May 22 2024. The official support period is 6-months
from this date.
Learn about function parameters and how to return a value from a method.
Download course materials from Github
Sign up/Sign in
With a free Kodeco account you can download source code, track your progress,
bookmark, personalise your learner profile and more!
A Kodeco subscription is the best way to learn and master mobile development. Learn iOS, Swift, Android, Kotlin, Flutter and Dart development and unlock our massive catalog of 50+ books and 4,000+ videos.