Learn To Create EvenOdd Program With Ruby on Rails.

Reads: 284  | Likes: 0  | Shelves: 0  | Comments: 0

More Details
Status: Finished  |  Genre: Editorial and Opinion  |  House: Booksie Classic
In this post we will look towards Ruby on Rails programming language and one simple program in Ruby on Rails.
This program will show you whether a number entered by you is even or odd.

Submitted: May 21, 2014

A A A | A A A

Submitted: May 21, 2014

A A A

A A A


In today’s web designing world we see lots of technology developed around us such as robotics, artificial intelligence, Google glass, Google car. All these high tech devices are executed through different programming languages which are used to trigger them. It has become a need for developers to learn programming languages so that they can create something amazing stuff.

In this post we will look towards Ruby on Rails programming language and one simple program in Ruby on Rails.

Like C or C++ language, Ruby on Rails is also an object oriented language having procedures and data fields in their programming language. Rails is a server on which programs of Ruby work upon. The purpose behind using Ruby on Rails is that it is easily understood by user, simple language to learn and write, saves cost, it is secure, also it can run on different platforms.

________________________________________________________________________________________________________

Learn to create an even odd program with Ruby on Rails.

This program will show you whether a number entered by you is even or odd. Follow these steps to create a program.

Part I – Installation of Rails

1. Visit www.google.com from your web browser

b9d1bbdb117f9d328f61a1d55e3c2184.jpg

________________________________________________________________________________________________________

2. Then type rails installer to download the rails server

75b433377629227168e13a4b92c740ee.jpg

________________________________________________________________________________________________________

3. Download it

954c448b7e305585b2f2b57afc17c19f.jpg

________________________________________________________________________________________________________

4. After downloading you will get following windows, then go on installing Rails as shown below

5a6aa08b254aa42294d0cc64c81819ee.jpg

21283a49efb6fa460041ff5e9f5f5a5f.jpg

 

19dce16421f2dcfd32f7fe5e1a36c2f1.jpg

 

a7007aca7ac70f30f79f941af9b09326.jpg

This completes the installation of Rails. Now we will write and execute our program in next part.

________________________________________________________________________________________________________

Part II – Writing code and executing it.

1. Open notepad on your computer screen Start -> All programs –> Accessories –> Notepad and type this code for even and odd

0d7061e2d7b63c35e341cb1a0a1fad95.jpg

Then save your file as extension of .rb, Here I have named it as evenodd.rb

________________________________________________________________________________________________________

2. Now open command prompt window to execute the above file as shown in figure below

290e545361a1d9afaf36d78f0408a018.jpg

________________________________________________________________________________________________________

3. You will be displayed with following screen when you will open command prompt window. Here enter your username and email-id. This is for 1st time when you are running server on your computer. So enter any username of your choice. Here I have entered “ruby” as user name and my email id.

31e11c579702f7e8d8a1f40f7ca60050.jpg

________________________________________________________________________________________________________

4. Now once you have done with it, an account will be created of yours and you will get following screen every time when you will open your command prompt window. Now enter the following commands as given in screen. First you will enter cd.. and then press ENTER. here cd is c drive of your computer

ba8d23ae5d91881183896c951acfa8ba.jpg

________________________________________________________________________________________________________

5. Then open your folder containing file of evenodd.rb, copy its location and paste it in command window by typing “cd path(C:\\Users\\user\\Desktop\\aa\\aa\\ruby program\\rubyprog)” as shown in given window

e3c005effd13738b09adb5d232e855ac.jpg

________________________________________________________________________________________________________

6. Then type your file name as shown in screen eg “ruby evenodd.rb” to excute it a press ENTER. You will get following window. Here enter any number and output will be shown to you wheter it is odd or even.

c03b172f03ba0f0107a71648913f7dc3.jpg

Thus we have successfully completed our program of even and odd in Ruby on Rails. You can also create different and lots of programming in ruby of rails, to learn more about Ruby on rails program watch video series of Ruby on Rails from Groundup at www.eduonix.com, you will get to know more about this programming languages.


© Copyright 2019 vikiG123. All rights reserved.

Add Your Comments:

More Editorial and Opinion Articles