SlideShare uma empresa Scribd logo
1 de 12
   Alaa Afifi kamal
   Faculty of computers and information cairo
    university
   Vice head to social at fci student union
   Participant at NYU Abu Dhabi Hackathon
   Intern at imagine cup university (microsoft)
   Social media member st scci
   FR member at Fekra
   alaa.kamal67@yahoo.com
Introduction to Ruby
Ruby
   Ruby is a powerful, flexible programming language you can use in web/Internet development, to
    process text, to create games, and as part of the popular Ruby on Rails web framework. Ruby is:
   High-level, meaning reading and writing Ruby is really easy—it looks a lot like regular English!
   Interpreted, meaning you don't need a compiler to write and run Ruby. You can write it here at
    Codecademy or even on your own computer (many are shipped with the Ruby interpreter built
    in—we'll get to the interpreter later in this lesson).
   Object-oriented, meaning it allows users to manipulate data structures called objects in order
    to build and execute programs. We'll learn more about objects later, but for now, all you need to
    know is everything in Ruby is an object.
   Easy to use. Ruby was designed by Yukihiro Matsumoto (often just called "Matz") in 1995. Matz
    set out to design a language that emphasized human needs over those of the computer, which is
    why Ruby is so easy to pick up.
Ruby
Outline :
   Data taypes(numbers,Booleans and string)
   Operators
   (Puts,print)
   Strings
   Single _line comments
   Multi_line comments
Data types

Numbers is a data tybe at Ruby to define numbers just
My _num=25


Booleans is a data tybe at Ruby to define Booleans just
My_bool=true or false just


string is a data tybe at Ruby to define strings just
My_string=“Ruby”
operators

   Addition(+) ,subtraction(-),multiplication(*),Division(/),Exponentiation(**) and
module(%)
Exponentiation(**) is used to get the power of the number
Ex: 2 x 2 x 2 =2**3=8 .
module(%) is used to get the remainder of division
Ex: 20%3= 2
How to write it as a code?
My_num=4+4
Output= 8
(Puts,print)

   The print command just takes whatever you give it and prints it in the
    screen.


   Puts it adds a new (blank) line after the things you want it to print
    Ex: puts”Hello”
        print”Ruby”
strings
Length:
if you want to get the legth of string do that
   Ex: “Ruby”.length
   output= 4
 reverse:
 this method help us to sort a list of values
  Ex: “Ruby”.reverse
  output= ybuR
   Downcase and upcase methods convert a string ALL UPPER CASE
    or lower case
    to use upcase or downcase
    EX: puts”ruby”.upcase
      the output: RUBY
    Ex: puts”RUBY”.downcase
     the output: ruby
Single _line comments

    A comment is a bit of text that Ruby won't try to run as code: it's just for
    humans to read. Writing good comments not only clarifies your code for other
    people who may read it, but helps remind you of what you were doing when
    you wrote the code days, months, or even years earlier.


we use # to write a comment
Ex: “ I love Ruby”.length # this line return the length
Multi_line comments
    You can write a comment that spans multiple lines by starting
     each line with a # , but there's an easier way.
     if you start with =begin and end with =end ,
everything between those two expressions will be a comment.
Ex:
=begin
I love ruby
    it’s nice
=end
Thank you




Copyrights to:Alaa Afifi

Mais conteúdo relacionado

Semelhante a Ruby

Ruby tutorial
Ruby tutorialRuby tutorial
Ruby tutorial
knoppix
 
Page List & Sample Material (Repaired)
Page List & Sample Material (Repaired)Page List & Sample Material (Repaired)
Page List & Sample Material (Repaired)
Muhammad Haseeb Shahid
 
ruby_vs_perl_and_python
ruby_vs_perl_and_pythonruby_vs_perl_and_python
ruby_vs_perl_and_python
tutorialsruby
 
ruby_vs_perl_and_python
ruby_vs_perl_and_pythonruby_vs_perl_and_python
ruby_vs_perl_and_python
tutorialsruby
 
On the path to become a jr. developer short version
On the path to become a jr. developer short versionOn the path to become a jr. developer short version
On the path to become a jr. developer short version
Antonelo Schoepf
 
Intro To Ror
Intro To RorIntro To Ror
Intro To Ror
myuser
 

Semelhante a Ruby (20)

ACM Init() lesson 1
ACM Init() lesson 1ACM Init() lesson 1
ACM Init() lesson 1
 
Ruby
RubyRuby
Ruby
 
Ruby tutorial
Ruby tutorialRuby tutorial
Ruby tutorial
 
Ruby on Rails Training - Module 1
Ruby on Rails Training - Module 1Ruby on Rails Training - Module 1
Ruby on Rails Training - Module 1
 
Ruby on Rails - An overview
Ruby on Rails -  An overviewRuby on Rails -  An overview
Ruby on Rails - An overview
 
Page List & Sample Material (Repaired)
Page List & Sample Material (Repaired)Page List & Sample Material (Repaired)
Page List & Sample Material (Repaired)
 
Ruby
RubyRuby
Ruby
 
Ruby Hell Yeah
Ruby Hell YeahRuby Hell Yeah
Ruby Hell Yeah
 
ruby_vs_perl_and_python
ruby_vs_perl_and_pythonruby_vs_perl_and_python
ruby_vs_perl_and_python
 
ruby_vs_perl_and_python
ruby_vs_perl_and_pythonruby_vs_perl_and_python
ruby_vs_perl_and_python
 
Rubykin
Rubykin Rubykin
Rubykin
 
On the path to become a jr. developer short version
On the path to become a jr. developer short versionOn the path to become a jr. developer short version
On the path to become a jr. developer short version
 
Ruby
RubyRuby
Ruby
 
Ruby
RubyRuby
Ruby
 
Ruby Basics
Ruby BasicsRuby Basics
Ruby Basics
 
FGCU Camp Talk
FGCU Camp TalkFGCU Camp Talk
FGCU Camp Talk
 
Ruby for .NET developers
Ruby for .NET developersRuby for .NET developers
Ruby for .NET developers
 
Ruby on Rails Introduction M&P - IT Skill Development Program 07
Ruby on Rails Introduction M&P - IT Skill Development Program 07Ruby on Rails Introduction M&P - IT Skill Development Program 07
Ruby on Rails Introduction M&P - IT Skill Development Program 07
 
Intro To Ror
Intro To RorIntro To Ror
Intro To Ror
 
Vim 讓你寫 Ruby 的速度飛起來
Vim 讓你寫 Ruby 的速度飛起來Vim 讓你寫 Ruby 的速度飛起來
Vim 讓你寫 Ruby 的速度飛起來
 

Último

Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 

Último (20)

The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 

Ruby

  • 1. Alaa Afifi kamal  Faculty of computers and information cairo university  Vice head to social at fci student union  Participant at NYU Abu Dhabi Hackathon  Intern at imagine cup university (microsoft)  Social media member st scci  FR member at Fekra  alaa.kamal67@yahoo.com
  • 3. Ruby  Ruby is a powerful, flexible programming language you can use in web/Internet development, to process text, to create games, and as part of the popular Ruby on Rails web framework. Ruby is:  High-level, meaning reading and writing Ruby is really easy—it looks a lot like regular English!  Interpreted, meaning you don't need a compiler to write and run Ruby. You can write it here at Codecademy or even on your own computer (many are shipped with the Ruby interpreter built in—we'll get to the interpreter later in this lesson).  Object-oriented, meaning it allows users to manipulate data structures called objects in order to build and execute programs. We'll learn more about objects later, but for now, all you need to know is everything in Ruby is an object.  Easy to use. Ruby was designed by Yukihiro Matsumoto (often just called "Matz") in 1995. Matz set out to design a language that emphasized human needs over those of the computer, which is why Ruby is so easy to pick up.
  • 4. Ruby Outline :  Data taypes(numbers,Booleans and string)  Operators  (Puts,print)  Strings  Single _line comments  Multi_line comments
  • 5. Data types Numbers is a data tybe at Ruby to define numbers just My _num=25 Booleans is a data tybe at Ruby to define Booleans just My_bool=true or false just string is a data tybe at Ruby to define strings just My_string=“Ruby”
  • 6. operators  Addition(+) ,subtraction(-),multiplication(*),Division(/),Exponentiation(**) and module(%) Exponentiation(**) is used to get the power of the number Ex: 2 x 2 x 2 =2**3=8 . module(%) is used to get the remainder of division Ex: 20%3= 2 How to write it as a code? My_num=4+4 Output= 8
  • 7. (Puts,print)  The print command just takes whatever you give it and prints it in the screen.  Puts it adds a new (blank) line after the things you want it to print Ex: puts”Hello” print”Ruby”
  • 8. strings Length: if you want to get the legth of string do that Ex: “Ruby”.length output= 4 reverse: this method help us to sort a list of values Ex: “Ruby”.reverse output= ybuR
  • 9. Downcase and upcase methods convert a string ALL UPPER CASE or lower case to use upcase or downcase EX: puts”ruby”.upcase the output: RUBY Ex: puts”RUBY”.downcase the output: ruby
  • 10. Single _line comments  A comment is a bit of text that Ruby won't try to run as code: it's just for humans to read. Writing good comments not only clarifies your code for other people who may read it, but helps remind you of what you were doing when you wrote the code days, months, or even years earlier. we use # to write a comment Ex: “ I love Ruby”.length # this line return the length
  • 11. Multi_line comments  You can write a comment that spans multiple lines by starting each line with a # , but there's an easier way. if you start with =begin and end with =end , everything between those two expressions will be a comment. Ex: =begin I love ruby it’s nice =end