Home About Rice Downloads Documents Others Cooker CookerGX
Documents  >  Reference  >  literal
Literals in the Rice

Literals

Literal is value that is directly described on the code.

For example,


int i = 2;//int literal

string s = "string literal";//string literal


Literals generates an instance of the corresponding type at the memory and returns its address.

Because literals is instance, it behaves in accordance with the rules of the type. Namely, it is able to call the setter, getter, and method via an instance.

For example,


int len = "Length".Length;//It call the Length getter of the string type.

string s = 1000.ToString();//It call the ToString() method of the int type.


For literal notation, please refer to the token of the manual.

For the behavior of literal, please refer to the corresponding type of the manual.

Next
Previous
Copyright © Rice All rights reserved.