TAILIEUCHUNG - HandBooks Professional Java-C-Scrip-SQL part 19

Tham khảo tài liệu 'handbooks professional java-c-scrip-sql part 19', 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ả | . About Ruby Ruby is a dynamic fully object-oriented language that s usually grouped with scripting languages. The scripting term for languages like Ruby Smalltalk and Python is a little too limited so I ll use the term applications language . If you ve used nothing but compiled languages like Java and C get ready to have some fun. Ruby will turn you loose. I suggest that you install it just go to http and type along. It comes with a primitive IDE but the command line works well. Fire up a Ruby shell by typing irb. You ll get a shell prompt irb main 001 0 . Ruby Is Fully OO From here you can evaluate Ruby statements. You ll frequently use irb to answer those tiny questions that come up often in programming. In Ruby everything is an object and if you type one alone Ruby will return that object. Type 4 and press Enter irb main 001 0 4 4 Unlike Java numbers are objects not primitives. For example you can do this irb main 008 0 4 Even nil is a class standing for nothing irb main 009 0 NilClass You don t have to worry about primitives or wrappers at all. More importantly you don t have to deal with those cases in an API. Ruby s reflection persistence engines and XML frameworks are all much simpler because you don t have to deal with all the edge cases related to primitives and arrays of primitives. . Typing Try to do an assignment without a declaration irb main 011 0 n 1 1 irb main 012 0 Fixnum So n has an object of type Fixnum. You didn t declare n at all. That s a strong hint that Ruby is dynamically typed. Now assign something else to n irb main 013 0 n fish fish irb main 014 0 String Now n has a string. We changed the type of the variable i. More accurately the type in Ruby is bound to the object but not the thing that contains it. So Ruby is dynamically typed. Let s try to do something strange irb main 015 0 n 4 TypeError cannot convert Fixnum into String from irb 15 in from irb 15 Ruby won t break .

TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.