Ruby Course – Codemeets– 02
November 26, 2020
Ruby programming lesson 2. Today we going to learn more about Ruby. In this tutorial, we will focus on Variable, Strings, Numbers, and Operations. It can provide extensive knowledge.
Variables are used to store information to be referenced and manipulated in a computer program. They also provide a way of labeling data with a descriptive name, so our programs can be understood more clearly by the reader and ourselves. It is helpful to think of variables as containers that hold information. Their sole purpose is to label and store data in memory. This data can then be used throughout your program.launchschool.com
Now you know what is variable, let’s use it Ruby Programming
character_name = "jenny" character_age = "23" puts "my name is "+ character_name puts "my age is "+ character_age
This Code output is My Name is jenny my age is 23. you can try this code in your pc.
Working with Strings Ruby Programming
Threads are traditionally alphabetical. Now you can see how it works. see below table and get idea about ruby strings.
Phone = "Apple Iphone"
Work with Strings
Working With Numbers
Every computer language uses numbers in particular. This is because it allows you to easily control the data. let me show you how to work with numbers in Ruby.
Operations & Math in Ruby Programming
In mathematics, we use different operations, i.e. maximum value, square root, fall. They are also used differently in programming. The following example will give you a broader understanding.
num = 30.67
it is a hard mathematics part but using ruby we can do it easy. see below table.
Now you have developed some knowledge about Ruby. Try typing this code on your computer as well. Practice
Thank for all!
See you Next Ruby Lesson Soon!