- Comprehensive Ruby Programming
- Jordan Hudgens
- 191字
- 2021-07-02 21:13:22
Variable code implementation
Now let's dive into the code. For a basic example, I'm going to store my name in a variable:
name = "Jordan"
If you go to repl.it and run this, you can see my name displayed in the Terminal:

Additionally, a variable can hold more than one value, and in many cases it's called an array (for which we will dedicate an entire section, later in this course). Consider this example:
address = ["123", "Anystreet", "Anytown", "TX"]
Again, in the Terminal, you can see all these values, but they will come with the square brackets. In fact, these brackets denote that it is an array of variables:

Later, we'll walk through how variables can also hold methods, which allow programs to store logic in addition to data that can be called when needed.
As you can see, the syntax for using variables in Ruby is quite straightforward. Unlike many other languages, Ruby variables do not require semicolons or a data type to be declared. This feature is possible because Ruby is a Just-in-Time (JIT) interpreted language, which automatically recognizes the data type based on what variables are stored.
- Spring 5企業級開發實戰
- Python從小白到大牛
- Java Web基礎與實例教程(第2版·微課版)
- INSTANT Weka How-to
- Servlet/JSP深入詳解
- Data Analysis with IBM SPSS Statistics
- Mastering Python High Performance
- Windows Server 2012 Unified Remote Access Planning and Deployment
- Mastering Apache Spark 2.x(Second Edition)
- Processing創意編程指南
- Mastering HTML5 Forms
- PowerDesigner 16 從入門到精通
- Elasticsearch Blueprints
- JavaWeb從入門到精通(視頻實戰版)
- 大話代碼架構:項目實戰版