- 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.
- Git Version Control Cookbook
- AngularJS Testing Cookbook
- PHP 從入門到項目實踐(超值版)
- Building a Home Security System with Raspberry Pi
- 大學(xué)計算機基礎(chǔ)實驗教程
- Java Web及其框架技術(shù)
- Java 9模塊化開發(fā):核心原則與實踐
- Kotlin編程實戰(zhàn):創(chuàng)建優(yōu)雅、富于表現(xiàn)力和高性能的JVM與Android應(yīng)用程序
- Tableau 10 Bootcamp
- JavaScript應(yīng)用開發(fā)實踐指南
- 從程序員角度學(xué)習(xí)數(shù)據(jù)庫技術(shù)(藍(lán)橋杯軟件大賽培訓(xùn)教材-Java方向)
- 數(shù)據(jù)分析與挖掘算法:Python實戰(zhàn)
- Java EE架構(gòu)設(shè)計與開發(fā)實踐
- PHP Microservices
- C語言程序設(shè)計教程