Course Content

Course Content

FAQs

A variable is a name Ruby uses to identify a specific object. For instance, "Toronto" is a city. The string "Toronto" is associated with the name (variable) city in this case. Consider it as if Ruby were to create two tables. One has items, whereas the other has names for them.

There are four types of variables in Ruby: Local ,Class, Instance, and Global

@title is a class-wide instance variable that is accessible to all methods. Declaring variables in your controller as instance variables (@title) in Ruby on Rails makes them available to your view.

Variables in Ruby are storage locations for data that will be used in programmes. Each variable is given a unique name. The names of these variables are based on naming conventions. In contrast to other programming languages, Ruby does not need the declaration of variables.

The assignment statement is written in the form of: "variable=value". For example, if you want to change the value of x to 5, your assignment statement would be "x=5".

Share With Friend

Have a friend to whom you would want to share this course?

Download LearnVern App

App Preview Image
App QR Code Image
Code Scan or Download the app
Google Play Store
Apple App Store
598K+ Downloads
App Download Section Circle 1
4.57 Avg. Ratings
App Download Section Circle 2
15K+ Reviews
App Download Section Circle 3
  • Learn anywhere on the go
  • Get regular updates about your enrolled or new courses
  • Share content with your friends
  • Evaluate your progress through practice tests
  • No internet connection needed
  • Enroll for the webinar and join at the time of the webinar from anywhere