Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

285
Views
¿Cómo se define una matriz de funciones (funciones) en Kotlin?

¿Cómo se define una matriz de funciones (funciones) en Kotlin?

Esta es mi suposición de cómo se haría...

 this.funs = arrayOf : Unit( this::openCamera, this::sendSMS, this::makeCall )

¿Cómo invocaría cada elemento de la matriz como una función en tiempo de ejecución? ¿Simplemente especificar 'funs' en lugar de openCamera(), sendSMS() y MakeCall() en un bucle forEach() funcionaría?

o... es esta la forma en que invocaría cada función:

 val function = getFunction(funs) function()
over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Si tuviera algunas funciones definidas como

 fun one() { print("ONE") } fun two() { print("TWO") } fun three() { print("THREE") }

Luego puede crear una matriz de estos como

 fun someFun(){ val arrayOfFunctions: Array<() -> Unit> = arrayOf(::one, ::two, ::three) arrayOfFunctions.forEach { function -> function() } }
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!