Đang chuẩn bị liên kết để tải về tài liệu:
HandBooks Professional Java-C-Scrip-SQL part 226

Đang chuẩn bị nút TẢI XUỐNG, xin hãy chờ

Tham khảo tài liệu 'handbooks professional java-c-scrip-sql part 226', công nghệ thông tin, kỹ thuật lập trình phục vụ nhu cầu học tập, nghiên cứu và làm việc hiệu quả | Ruby in a Nutshell By Yukihiro Matsumoto Chapter 2. Language Basics 2.5 Variables There are five types of variables in Ruby global instance class locals and constants. As you might expect global variables are accessible globally to the program instance variables belong to an object class variables to a class and constants are well. constant. Ruby uses special characters to differentiate between the different kinds of variables. At a glance you can tell what kind of variable is being used. Global Variables foo Global variables begin with . Uninitialized global variables have the value nil and produce warnings with the -w option . Some global variables have special behavior. See Chapter 3. Instance Variables @foo Instance variables begin with @. Uninitialized instance variables have the value nil and produce warnings with the -w option . Class Variables @@foo Class variables begin with @ @ and must be initialized before they can be used in method definitions. Referencing an uninitialized class variable produces an error. Class variables are shared among descendants of the class or module in which the class variables are defined. Overriding class variables produce warnings with the -w option. Local Variables foo Local variables begin with a lowercase letter or _. The scope of a local variable ranges from class module def or do to the corresponding end or from a block s opening brace to its close brace . The scope introduced by a block allows it to reference local variables outside the block but scopes introduced by others don t. When an uninitialized local variable is referenced it is interpreted as a call to a method that has no arguments. Constants Foo Constants begin with an uppercase letter. Constants defined within a class or module can be accessed from within that class or module and those defined outside a class or module can be accessed globally. Constants may not be defined within methods. Referencing an uninitialized constant produces an error. Making an .

TÀI LIỆU LIÊN QUAN