Scala Classic-----002-scala function definition, Process Control, exception handling getting started combat

Source: Internet
Author: User

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/6F/91/wKioL1WhEYHR0V55AAi8dfKDnAg782.jpg "title=" 002- Scala function definition, Process Control, exception handling get started in combat. png "alt=" wkiol1wheyhr0v55aai8dfkdnag782.jpg "/>


002-scala function definition, Process Control, exception handling getting started combat

Scalafunction Definitionstatement end no semicolondefining an parameterless functionDefFunction Name(Parameter name:parameter Type) [: unit=]{function Body}The teacher's code My actual code The reason is that the integrated development environment comes with a version of 2.11.0variablesConstants(not variable)StatementValVariable DeclarationVarno reference function calls without parentheses()defines a function with the return value of a parameterDefFunction Name(Parameter name:parameter Type...):return value type={function Body}Teacher Code Note that the last one is b . is the return value of this function default last behavior return valueProcess ControlIfStatementif (!args.isempty) file=arg (0)streamlined syntax structureprintln (if (!args.isempty) args (0) Else "Spark.txt") Do{}while ()Looping StatementsaboveForStatementfor (I <-1 to ten) {}for (i <-1.to (10)) {}+-*/%Print all file statements for the current directoryException HandlingOpenFile (file)may produce an exceptionwith theJavasamesame Usetry{}catch{}finally{}Way to handlewith theJavadifferentthroughCasematch a different exceptionNote The order of exceptions

Welcome to the vast number of enthusiasts to learn and exchange. Also welcome to join the study enthusiasts

DT Big Data Dream Factory Exchange Group: 462923555

DT Big Data public account: Dt_spark

Video Watch Links

http://www.tudou.com/plcover/Yy5F5gsurSE/


Scala Classic-----002-scala function definition, Process Control, exception handling getting started combat

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.