650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/6F/91/wKioL1WhHxzTubgpAAi8dfKDnAg285.jpg "title=" 002- Scala function definition, Process Control, exception handling get started in combat. png "alt=" wkiol1whhxztubgpaai8dfkdnag285.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/
002-scala function definition, Process Control, exception handling getting started combat