Advertisement
rangga_hrdme

KINDS OF FUNCTION 1

Apr 26th, 2021
217
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Kotlin 0.71 KB | None | 0 0
  1. // Procedure
  2. fun main() {
  3.     hello()
  4.     interest(1_000_000.0, 5.0, 7.0)
  5. }
  6.  
  7. // Procedure
  8. fun hello() {
  9.     println("Hai Universe...")
  10. }
  11.  
  12. // Function (PARAMETER)
  13. fun interest(money: Double, percent: Double, months: Double) {
  14.     val result = money * (percent / 100) * (months / 12)
  15.     val results = result.toInt()
  16.     println("Money: $money Percent: $percent Month: $months Interest: $results Decimal: $result")
  17. }
  18. /* 1. Function without parameter (Procedure), example: main()
  19. * 2. Function with parameter, example: interest(parameter). interest() is constructor
  20. * 3. Function with return (method)
  21. * Pray 4 Uyghur: https://bylinetimes.com/2020/08/24/death-is-everywhere-millions-more-uyghurs-missing/
  22. */
  23.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement