Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

Nesting and Polymorphism of methods in the Scala Series of big data's tutorial

Shulou Source: shulou.com Published: 2022-06-03 05:57:15 11月12日 Update

Big data tutorials share the nesting and method polymorphism of the Scala series of methods.

Method to define other methods nested in the

Example 1

Object EmbedDemo {

Def add3 (XRO Intrection yRV Int ZRO int) = {

Def add2 (XRV Intjcmntjjjjnt) = {

Xfanty

}

Add2 (add2 (XBY), z)

}

Def main (args: Array [String]): Unit = {

Println (add3 (1 and 2)) / / 6

}

}

Example 2

Def factorial (x: Int): Int = {

Def fact (x: Int, accumulator: Int): Int = {

If (x

Tags: Methods polymorphisms examples tutorials data parameters can be passed types Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Xiaomi Huawei OPPO Reno Linux Shulou Information