This document contains a summary of Alaa Afifi's background and experience including education at Cairo University's Faculty of Computers and Information, participation in hackathons and internships, and contact information. It also provides an introduction to the Ruby programming language, covering its data types, operators, print/puts functions, strings, and single-line and multi-line comments.
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
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