How to execute a function in apache-scala?

0 votes

Can anyone show anyone function execution in scala?

Jul 1, 2019 in Apache Spark by zunaid

recategorized Jul 4, 2019 by Gitika 118 views

2 answers to this question.

0 votes

Hi,

Here is a simple example of how you can execute a function in Scala, for this you need to write one function in Scala shell below:

scala> println("Any text")

Here is a simple example solved with the output:

Hope it helps.

answered Jul 1, 2019 by Gitika
• 36,530 points
0 votes
Function Definition :

def test():Unit{

var a=10

var b=20

var c=a+b

}

calling function : test
answered Aug 5 by Ramkumar Ramasamy

Hey,

Thank you for your contribution to the Edureka Community.

Register/Sign up on the community to gain points for further contributions. You may ask questions, answer, upvote, and downvote an answer. Each of these would fetch you points and you could be among the top contributors and win exciting merchandise from Edureka.

Cheers!

Related Questions In Apache Spark

0 votes
1 answer

How to append a list in Scala?

Hey, For this purpose, we use the single ...READ MORE

answered Jul 26, 2019 in Apache Spark by Gitika
• 36,530 points
1,364 views
0 votes
1 answer

How to search for a Key in a Scala Map?

Hey, The Map.contains() method will tell you if ...READ MORE

answered Jul 29, 2019 in Apache Spark by Gitika
• 36,530 points
82 views
0 votes
1 answer

How to format a string in Scala?

Hey, To format a string, use the .format ...READ MORE

answered Jul 30, 2019 in Apache Spark by Gitika
• 36,530 points
97 views
0 votes
1 answer
0 votes
1 answer

How to get the number of elements in partition?

rdd.mapPartitions(iter => Array(iter.size).iterator, true) This command will ...READ MORE

answered May 8, 2018 in Apache Spark by kurt_cobain
• 9,320 points
538 views
0 votes
1 answer

How to calculate the result of formula with Scala?

Hi, You can use a simple mathematical calculation ...READ MORE

answered Jul 1, 2019 in Apache Spark by Gitika
• 36,530 points
165 views
0 votes
1 answer

error:error: only classes can have declared but undefined members.

Hi, This happens in Scala whenever you won't ...READ MORE

answered Jul 24, 2019 in Apache Spark by Gitika
• 36,530 points
348 views
0 votes
1 answer

The file exists before processing with hadoop command

Took session and it got resolved. READ MORE

answered Dec 18, 2017 in Big Data Hadoop by Sudhir
• 1,610 points
177 views
0 votes
1 answer

How to check if a particular keyword exists in Apache Spark?

Hey, You can try this code to get ...READ MORE

answered Jul 22, 2019 in Apache Spark by Gitika
• 36,530 points
519 views
0 votes
1 answer

How to use nested function in Scala?

Hey, With Scala, we can define a Scala ...READ MORE

answered Jul 26, 2019 in Apache Spark by Gitika
• 36,530 points
122 views