Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

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

2025-01-26 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/03 Report--

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

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 207

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report