about Def/val/lazy Val
def
DEF is similar to every re-assignment, and if you define a function with Def, you get a function val every time.
Get once, and execute immediately (strictly executed) lazy Val
Lazy execution, which is assignment (binding)
The difference between #define, const, typedef#define is not defining variables, it's just for text substitution.For example:#define PI 3.1415926float Angel;angel=30*pi/180;Then, when the program is compiled, the compiler will first "#define PI 3.141
Definition:
The # define Directive
You can use the # define directive to give a meaningful name to a constant in your program. The two forms of the syntax are:
Syntax
# Define identifier token-stringopt
# Define identifier [(identifieropt,...,
The latest project to use the Spark platform, whether it is to see the source code or writing programs need to use the Scala language, after two days of contact, the map map here a bit of doubt, do a bit of testing after a note of their own
Read the manual that define defines constants that allow only:
Only scalar and null are allowed. The type of scalar is integer, Float,string, or Boolean. It is also possible to define a constant value of type resource, but it is not recommended to
Reading today when you see the code while (Cin>>val), suddenly thinking about how to write the legality of how to determine. We all know that CIN is a stream object, and the >> operator returns the stream object on the left, that is, Cin>>val
Read the manual. Define defined constants Allow only:
Only scalar and null are allowed. The type of the scalar is integer, Float,string, or Boolean. It is also possible to define the type of a constant value as resource, but this is not recommended,
According to the manual, the constants defined by define are only allowed:Only scalar and null are allowed. The scalar type is integer, float, string, or boolean. It can also define the type of constant value as resource, but it is not recommended
Define constant. According to the manual, only constants defined by define are allowed: scalar and null. The scalar type is integer, float, string, or boolean. You can also define the constant value type as resource. see the manual. the constants
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.