SlideShare a Scribd company logo
RUBY
- A PROGRAMMER’S FUN LANGUAGE
-KHAN
Introduction:
1. An Imperative language
2. Object – oriented language
3. Can be used on all platforms
4. Programmer friendly
▶ Easy syntaxes :
Loops do not need blocks.
Pre-defined blocks for loops and conditions.
Accessing of elements is easy.
No need to specify the data types of variables.
Key words are easier to use that follow basic English language.
▶ Variables can be easily classified into various types.
▶ Single statement without any class or method can also be
executed.
▶ Many predefined methods for arithmetic operations.
▶ Ruby considers every entity in it as an object.
▶ Object creation is very easy and it can access every variable and
method in the class and also super class.
Classes in Ruby:
▶ Classes can be used in Ruby with methods and variables in it.
▶ Classes may contain Class, Global, Instance , Block variables.
▶ Object must be created to access a class created. The object of a
class or any variable can also be created.
▶ Ruby supports Single Inheritance from parent class.
Inheritance uses “<“ symbol to access super class
elements.
Variables and Methods :
▶ Ruby has five types of variables :
▶ Global : These can be accessed along all the classes and the
objects in the package or project. It is classified by “ $“
▶ Instance : These can be accessed in the class in which it is declared
. It is classified by “ @“
▶ Class variables : These can be accessed in the class in which it is
declared . It should be compulsory initialised before it is used in the
further operations .It is classified by “ @@“
▶ Block variables: These can be accessed only in the Block in which it
is declared . The scope of the variables is only within the block.
▶ Ruby Pseudo-Variables: these are constants like ‘true’ ,’ false’, ‘self’ ,
‘nil’ .
Ranges :
▶ Ruby has a special feature named Ranges.
▶ It is same as the ‘for’ loop in various programming languages .
▶ This iterates the continuous variables in the range.
▶ Example:
▶ (1..10) gives values from 1 to 10 .
▶ (‘a’..’g’) gives characters from a to g in alphabetical order.

More Related Content

What's hot

Java variable types
Java variable typesJava variable types
Java variable types
Soba Arjun
 
2- Introduction to java II
2-  Introduction to java II2-  Introduction to java II
2- Introduction to java II
Ghadeer AlHasan
 
Multiple Inheritance
Multiple InheritanceMultiple Inheritance
Multiple Inheritance
adil raja
 
5- Overriding and Abstraction In Java
5- Overriding and Abstraction In Java5- Overriding and Abstraction In Java
5- Overriding and Abstraction In Java
Ghadeer AlHasan
 
Lecture 2
Lecture 2Lecture 2
Lecture 2
emailharmeet
 
Delegate - KhanhLD
Delegate - KhanhLDDelegate - KhanhLD
Delegate - KhanhLD
Framgia Vietnam
 
Object as function argument , friend and static function by shahzad younas
Object as function argument , friend and static function by shahzad younasObject as function argument , friend and static function by shahzad younas
Object as function argument , friend and static function by shahzad younas
Shahzad Younas
 
Polymorphism in Python
Polymorphism in Python Polymorphism in Python
Polymorphism in Python
Home
 
Friend function & friend class
Friend function & friend classFriend function & friend class
Friend function & friend class
Abhishek Wadhwa
 
Object oriented programming
Object oriented programmingObject oriented programming
Object oriented programming
Jun Shimizu
 
OOPS Characteristics
OOPS CharacteristicsOOPS Characteristics
Friend Function
Friend FunctionFriend Function
Friend Function
Mehak Tawakley
 
Final presentation programming
Final presentation programmingFinal presentation programming
Final presentation programming
haider ali
 
Lecture 4
Lecture 4Lecture 4
Lecture 4
emailharmeet
 
Ruby
RubyRuby
27csharp
27csharp27csharp
27csharp
Sireesh K
 
Python: Multiple Inheritance
Python: Multiple InheritancePython: Multiple Inheritance
Python: Multiple Inheritance
Damian T. Gordon
 
Oopsinphp
OopsinphpOopsinphp
Oopsinphp
NithyaNithyav
 
Java interfaces
Java   interfacesJava   interfaces
Java interfaces
Elizabeth alexander
 

What's hot (19)

Java variable types
Java variable typesJava variable types
Java variable types
 
2- Introduction to java II
2-  Introduction to java II2-  Introduction to java II
2- Introduction to java II
 
Multiple Inheritance
Multiple InheritanceMultiple Inheritance
Multiple Inheritance
 
5- Overriding and Abstraction In Java
5- Overriding and Abstraction In Java5- Overriding and Abstraction In Java
5- Overriding and Abstraction In Java
 
Lecture 2
Lecture 2Lecture 2
Lecture 2
 
Delegate - KhanhLD
Delegate - KhanhLDDelegate - KhanhLD
Delegate - KhanhLD
 
Object as function argument , friend and static function by shahzad younas
Object as function argument , friend and static function by shahzad younasObject as function argument , friend and static function by shahzad younas
Object as function argument , friend and static function by shahzad younas
 
Polymorphism in Python
Polymorphism in Python Polymorphism in Python
Polymorphism in Python
 
Friend function & friend class
Friend function & friend classFriend function & friend class
Friend function & friend class
 
Object oriented programming
Object oriented programmingObject oriented programming
Object oriented programming
 
OOPS Characteristics
OOPS CharacteristicsOOPS Characteristics
OOPS Characteristics
 
Friend Function
Friend FunctionFriend Function
Friend Function
 
Final presentation programming
Final presentation programmingFinal presentation programming
Final presentation programming
 
Lecture 4
Lecture 4Lecture 4
Lecture 4
 
Ruby
RubyRuby
Ruby
 
27csharp
27csharp27csharp
27csharp
 
Python: Multiple Inheritance
Python: Multiple InheritancePython: Multiple Inheritance
Python: Multiple Inheritance
 
Oopsinphp
OopsinphpOopsinphp
Oopsinphp
 
Java interfaces
Java   interfacesJava   interfaces
Java interfaces
 

Similar to Ruby_Basic.pptx

java part 1 computer science.pptx
java part 1 computer science.pptxjava part 1 computer science.pptx
java part 1 computer science.pptx
MUHAMMED MASHAHIL PUKKUNNUMMAL
 
Inheritance
InheritanceInheritance
Inheritance
Munsif Ullah
 
Core Java Introduction | Basics
Core Java Introduction  | BasicsCore Java Introduction  | Basics
Core Java Introduction | Basics
Hùng Nguyễn Huy
 
Inheritance and Polymorphism
Inheritance and PolymorphismInheritance and Polymorphism
Inheritance and Polymorphism
KartikKapgate
 
Class Members Access/Visibility Guide (Checklist)
Class Members Access/Visibility Guide (Checklist)Class Members Access/Visibility Guide (Checklist)
Class Members Access/Visibility Guide (Checklist)
Jayasree Perilakkalam
 
Lecture 8
Lecture 8Lecture 8
Traits composition
Traits compositionTraits composition
Traits composition
Marielle Lange
 
Md03 - part3
Md03 - part3Md03 - part3
Md03 - part3
Rakesh Madugula
 
11 Inheritance.ppt
11 Inheritance.ppt11 Inheritance.ppt
11 Inheritance.ppt
LadallaRajKumar
 
PPT Lecture-1.4.pptx
PPT Lecture-1.4.pptxPPT Lecture-1.4.pptx
PPT Lecture-1.4.pptx
HimanshuPandey957216
 
Inheritance in C++
Inheritance in C++Inheritance in C++
Inheritance in C++
RAJ KUMAR
 
Unit 3
Unit 3Unit 3
full defination of final opp.pptx
full defination of final opp.pptxfull defination of final opp.pptx
full defination of final opp.pptx
rayanbabur
 
OOP Assign No.03(AP).pdf
OOP Assign No.03(AP).pdfOOP Assign No.03(AP).pdf
OOP Assign No.03(AP).pdf
Anant240318
 
OCP Java (OCPJP) 8 Exam Quick Reference Card
OCP Java (OCPJP) 8 Exam Quick Reference CardOCP Java (OCPJP) 8 Exam Quick Reference Card
OCP Java (OCPJP) 8 Exam Quick Reference Card
Hari kiran G
 
Java chapter 5
Java chapter 5Java chapter 5
Java chapter 5
Abdii Rashid
 
Java unit 7
Java unit 7Java unit 7
Java unit 7
Shipra Swati
 
Only oop
Only oopOnly oop
Only oop
anitarooge
 
Java/J2EE interview Qestions
Java/J2EE interview QestionsJava/J2EE interview Qestions
Java/J2EE interview Qestions
Arun Vasanth
 
Java session2
Java session2Java session2
Java session2
Rajeev Kumar
 

Similar to Ruby_Basic.pptx (20)

java part 1 computer science.pptx
java part 1 computer science.pptxjava part 1 computer science.pptx
java part 1 computer science.pptx
 
Inheritance
InheritanceInheritance
Inheritance
 
Core Java Introduction | Basics
Core Java Introduction  | BasicsCore Java Introduction  | Basics
Core Java Introduction | Basics
 
Inheritance and Polymorphism
Inheritance and PolymorphismInheritance and Polymorphism
Inheritance and Polymorphism
 
Class Members Access/Visibility Guide (Checklist)
Class Members Access/Visibility Guide (Checklist)Class Members Access/Visibility Guide (Checklist)
Class Members Access/Visibility Guide (Checklist)
 
Lecture 8
Lecture 8Lecture 8
Lecture 8
 
Traits composition
Traits compositionTraits composition
Traits composition
 
Md03 - part3
Md03 - part3Md03 - part3
Md03 - part3
 
11 Inheritance.ppt
11 Inheritance.ppt11 Inheritance.ppt
11 Inheritance.ppt
 
PPT Lecture-1.4.pptx
PPT Lecture-1.4.pptxPPT Lecture-1.4.pptx
PPT Lecture-1.4.pptx
 
Inheritance in C++
Inheritance in C++Inheritance in C++
Inheritance in C++
 
Unit 3
Unit 3Unit 3
Unit 3
 
full defination of final opp.pptx
full defination of final opp.pptxfull defination of final opp.pptx
full defination of final opp.pptx
 
OOP Assign No.03(AP).pdf
OOP Assign No.03(AP).pdfOOP Assign No.03(AP).pdf
OOP Assign No.03(AP).pdf
 
OCP Java (OCPJP) 8 Exam Quick Reference Card
OCP Java (OCPJP) 8 Exam Quick Reference CardOCP Java (OCPJP) 8 Exam Quick Reference Card
OCP Java (OCPJP) 8 Exam Quick Reference Card
 
Java chapter 5
Java chapter 5Java chapter 5
Java chapter 5
 
Java unit 7
Java unit 7Java unit 7
Java unit 7
 
Only oop
Only oopOnly oop
Only oop
 
Java/J2EE interview Qestions
Java/J2EE interview QestionsJava/J2EE interview Qestions
Java/J2EE interview Qestions
 
Java session2
Java session2Java session2
Java session2
 

More from Mohammad Junaid Khan

Decision trees in Machine Learning
Decision trees in Machine Learning Decision trees in Machine Learning
Decision trees in Machine Learning
Mohammad Junaid Khan
 
K - Nearest neighbor ( KNN )
K - Nearest neighbor  ( KNN )K - Nearest neighbor  ( KNN )
K - Nearest neighbor ( KNN )
Mohammad Junaid Khan
 
Support Vector Machines ( SVM )
Support Vector Machines ( SVM ) Support Vector Machines ( SVM )
Support Vector Machines ( SVM )
Mohammad Junaid Khan
 
Rise of PHP and Laravel. Latest Web Frameworks built on PHP.
Rise of PHP and Laravel. Latest Web Frameworks built on PHP.Rise of PHP and Laravel. Latest Web Frameworks built on PHP.
Rise of PHP and Laravel. Latest Web Frameworks built on PHP.
Mohammad Junaid Khan
 
Python
PythonPython
My SQL 1
My SQL 1My SQL 1
Wireless transmission of power
Wireless transmission of powerWireless transmission of power
Wireless transmission of power
Mohammad Junaid Khan
 

More from Mohammad Junaid Khan (7)

Decision trees in Machine Learning
Decision trees in Machine Learning Decision trees in Machine Learning
Decision trees in Machine Learning
 
K - Nearest neighbor ( KNN )
K - Nearest neighbor  ( KNN )K - Nearest neighbor  ( KNN )
K - Nearest neighbor ( KNN )
 
Support Vector Machines ( SVM )
Support Vector Machines ( SVM ) Support Vector Machines ( SVM )
Support Vector Machines ( SVM )
 
Rise of PHP and Laravel. Latest Web Frameworks built on PHP.
Rise of PHP and Laravel. Latest Web Frameworks built on PHP.Rise of PHP and Laravel. Latest Web Frameworks built on PHP.
Rise of PHP and Laravel. Latest Web Frameworks built on PHP.
 
Python
PythonPython
Python
 
My SQL 1
My SQL 1My SQL 1
My SQL 1
 
Wireless transmission of power
Wireless transmission of powerWireless transmission of power
Wireless transmission of power
 

Recently uploaded

RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
thanhdowork
 
New techniques for characterising damage in rock slopes.pdf
New techniques for characterising damage in rock slopes.pdfNew techniques for characterising damage in rock slopes.pdf
New techniques for characterising damage in rock slopes.pdf
wisnuprabawa3
 
Swimming pool mechanical components design.pptx
Swimming pool  mechanical components design.pptxSwimming pool  mechanical components design.pptx
Swimming pool mechanical components design.pptx
yokeleetan1
 
Recycled Concrete Aggregate in Construction Part III
Recycled Concrete Aggregate in Construction Part IIIRecycled Concrete Aggregate in Construction Part III
Recycled Concrete Aggregate in Construction Part III
Aditya Rajan Patra
 
Advanced control scheme of doubly fed induction generator for wind turbine us...
Advanced control scheme of doubly fed induction generator for wind turbine us...Advanced control scheme of doubly fed induction generator for wind turbine us...
Advanced control scheme of doubly fed induction generator for wind turbine us...
IJECEIAES
 
Modelagem de um CSTR com reação endotermica.pdf
Modelagem de um CSTR com reação endotermica.pdfModelagem de um CSTR com reação endotermica.pdf
Modelagem de um CSTR com reação endotermica.pdf
camseq
 
Iron and Steel Technology Roadmap - Towards more sustainable steelmaking.pdf
Iron and Steel Technology Roadmap - Towards more sustainable steelmaking.pdfIron and Steel Technology Roadmap - Towards more sustainable steelmaking.pdf
Iron and Steel Technology Roadmap - Towards more sustainable steelmaking.pdf
RadiNasr
 
sieving analysis and results interpretation
sieving analysis and results interpretationsieving analysis and results interpretation
sieving analysis and results interpretation
ssuser36d3051
 
Manufacturing Process of molasses based distillery ppt.pptx
Manufacturing Process of molasses based distillery ppt.pptxManufacturing Process of molasses based distillery ppt.pptx
Manufacturing Process of molasses based distillery ppt.pptx
Madan Karki
 
Question paper of renewable energy sources
Question paper of renewable energy sourcesQuestion paper of renewable energy sources
Question paper of renewable energy sources
mahammadsalmanmech
 
DfMAy 2024 - key insights and contributions
DfMAy 2024 - key insights and contributionsDfMAy 2024 - key insights and contributions
DfMAy 2024 - key insights and contributions
gestioneergodomus
 
basic-wireline-operations-course-mahmoud-f-radwan.pdf
basic-wireline-operations-course-mahmoud-f-radwan.pdfbasic-wireline-operations-course-mahmoud-f-radwan.pdf
basic-wireline-operations-course-mahmoud-f-radwan.pdf
NidhalKahouli2
 
Properties Railway Sleepers and Test.pptx
Properties Railway Sleepers and Test.pptxProperties Railway Sleepers and Test.pptx
Properties Railway Sleepers and Test.pptx
MDSABBIROJJAMANPAYEL
 
PPT on GRP pipes manufacturing and testing
PPT on GRP pipes manufacturing and testingPPT on GRP pipes manufacturing and testing
PPT on GRP pipes manufacturing and testing
anoopmanoharan2
 
Low power architecture of logic gates using adiabatic techniques
Low power architecture of logic gates using adiabatic techniquesLow power architecture of logic gates using adiabatic techniques
Low power architecture of logic gates using adiabatic techniques
nooriasukmaningtyas
 
KuberTENes Birthday Bash Guadalajara - K8sGPT first impressions
KuberTENes Birthday Bash Guadalajara - K8sGPT first impressionsKuberTENes Birthday Bash Guadalajara - K8sGPT first impressions
KuberTENes Birthday Bash Guadalajara - K8sGPT first impressions
Victor Morales
 
International Conference on NLP, Artificial Intelligence, Machine Learning an...
International Conference on NLP, Artificial Intelligence, Machine Learning an...International Conference on NLP, Artificial Intelligence, Machine Learning an...
International Conference on NLP, Artificial Intelligence, Machine Learning an...
gerogepatton
 
Exception Handling notes in java exception
Exception Handling notes in java exceptionException Handling notes in java exception
Exception Handling notes in java exception
Ratnakar Mikkili
 
Heat Resistant Concrete Presentation ppt
Heat Resistant Concrete Presentation pptHeat Resistant Concrete Presentation ppt
Heat Resistant Concrete Presentation ppt
mamunhossenbd75
 
Electric vehicle and photovoltaic advanced roles in enhancing the financial p...
Electric vehicle and photovoltaic advanced roles in enhancing the financial p...Electric vehicle and photovoltaic advanced roles in enhancing the financial p...
Electric vehicle and photovoltaic advanced roles in enhancing the financial p...
IJECEIAES
 

Recently uploaded (20)

RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
 
New techniques for characterising damage in rock slopes.pdf
New techniques for characterising damage in rock slopes.pdfNew techniques for characterising damage in rock slopes.pdf
New techniques for characterising damage in rock slopes.pdf
 
Swimming pool mechanical components design.pptx
Swimming pool  mechanical components design.pptxSwimming pool  mechanical components design.pptx
Swimming pool mechanical components design.pptx
 
Recycled Concrete Aggregate in Construction Part III
Recycled Concrete Aggregate in Construction Part IIIRecycled Concrete Aggregate in Construction Part III
Recycled Concrete Aggregate in Construction Part III
 
Advanced control scheme of doubly fed induction generator for wind turbine us...
Advanced control scheme of doubly fed induction generator for wind turbine us...Advanced control scheme of doubly fed induction generator for wind turbine us...
Advanced control scheme of doubly fed induction generator for wind turbine us...
 
Modelagem de um CSTR com reação endotermica.pdf
Modelagem de um CSTR com reação endotermica.pdfModelagem de um CSTR com reação endotermica.pdf
Modelagem de um CSTR com reação endotermica.pdf
 
Iron and Steel Technology Roadmap - Towards more sustainable steelmaking.pdf
Iron and Steel Technology Roadmap - Towards more sustainable steelmaking.pdfIron and Steel Technology Roadmap - Towards more sustainable steelmaking.pdf
Iron and Steel Technology Roadmap - Towards more sustainable steelmaking.pdf
 
sieving analysis and results interpretation
sieving analysis and results interpretationsieving analysis and results interpretation
sieving analysis and results interpretation
 
Manufacturing Process of molasses based distillery ppt.pptx
Manufacturing Process of molasses based distillery ppt.pptxManufacturing Process of molasses based distillery ppt.pptx
Manufacturing Process of molasses based distillery ppt.pptx
 
Question paper of renewable energy sources
Question paper of renewable energy sourcesQuestion paper of renewable energy sources
Question paper of renewable energy sources
 
DfMAy 2024 - key insights and contributions
DfMAy 2024 - key insights and contributionsDfMAy 2024 - key insights and contributions
DfMAy 2024 - key insights and contributions
 
basic-wireline-operations-course-mahmoud-f-radwan.pdf
basic-wireline-operations-course-mahmoud-f-radwan.pdfbasic-wireline-operations-course-mahmoud-f-radwan.pdf
basic-wireline-operations-course-mahmoud-f-radwan.pdf
 
Properties Railway Sleepers and Test.pptx
Properties Railway Sleepers and Test.pptxProperties Railway Sleepers and Test.pptx
Properties Railway Sleepers and Test.pptx
 
PPT on GRP pipes manufacturing and testing
PPT on GRP pipes manufacturing and testingPPT on GRP pipes manufacturing and testing
PPT on GRP pipes manufacturing and testing
 
Low power architecture of logic gates using adiabatic techniques
Low power architecture of logic gates using adiabatic techniquesLow power architecture of logic gates using adiabatic techniques
Low power architecture of logic gates using adiabatic techniques
 
KuberTENes Birthday Bash Guadalajara - K8sGPT first impressions
KuberTENes Birthday Bash Guadalajara - K8sGPT first impressionsKuberTENes Birthday Bash Guadalajara - K8sGPT first impressions
KuberTENes Birthday Bash Guadalajara - K8sGPT first impressions
 
International Conference on NLP, Artificial Intelligence, Machine Learning an...
International Conference on NLP, Artificial Intelligence, Machine Learning an...International Conference on NLP, Artificial Intelligence, Machine Learning an...
International Conference on NLP, Artificial Intelligence, Machine Learning an...
 
Exception Handling notes in java exception
Exception Handling notes in java exceptionException Handling notes in java exception
Exception Handling notes in java exception
 
Heat Resistant Concrete Presentation ppt
Heat Resistant Concrete Presentation pptHeat Resistant Concrete Presentation ppt
Heat Resistant Concrete Presentation ppt
 
Electric vehicle and photovoltaic advanced roles in enhancing the financial p...
Electric vehicle and photovoltaic advanced roles in enhancing the financial p...Electric vehicle and photovoltaic advanced roles in enhancing the financial p...
Electric vehicle and photovoltaic advanced roles in enhancing the financial p...
 

Ruby_Basic.pptx

  • 1. RUBY - A PROGRAMMER’S FUN LANGUAGE -KHAN
  • 2. Introduction: 1. An Imperative language 2. Object – oriented language 3. Can be used on all platforms 4. Programmer friendly
  • 3. ▶ Easy syntaxes : Loops do not need blocks. Pre-defined blocks for loops and conditions. Accessing of elements is easy. No need to specify the data types of variables. Key words are easier to use that follow basic English language.
  • 4. ▶ Variables can be easily classified into various types. ▶ Single statement without any class or method can also be executed. ▶ Many predefined methods for arithmetic operations.
  • 5. ▶ Ruby considers every entity in it as an object. ▶ Object creation is very easy and it can access every variable and method in the class and also super class.
  • 6. Classes in Ruby: ▶ Classes can be used in Ruby with methods and variables in it. ▶ Classes may contain Class, Global, Instance , Block variables. ▶ Object must be created to access a class created. The object of a class or any variable can also be created. ▶ Ruby supports Single Inheritance from parent class. Inheritance uses “<“ symbol to access super class elements.
  • 7. Variables and Methods : ▶ Ruby has five types of variables : ▶ Global : These can be accessed along all the classes and the objects in the package or project. It is classified by “ $“ ▶ Instance : These can be accessed in the class in which it is declared . It is classified by “ @“ ▶ Class variables : These can be accessed in the class in which it is declared . It should be compulsory initialised before it is used in the further operations .It is classified by “ @@“ ▶ Block variables: These can be accessed only in the Block in which it is declared . The scope of the variables is only within the block. ▶ Ruby Pseudo-Variables: these are constants like ‘true’ ,’ false’, ‘self’ , ‘nil’ .
  • 8. Ranges : ▶ Ruby has a special feature named Ranges. ▶ It is same as the ‘for’ loop in various programming languages . ▶ This iterates the continuous variables in the range. ▶ Example: ▶ (1..10) gives values from 1 to 10 . ▶ (‘a’..’g’) gives characters from a to g in alphabetical order.