my net house

WAHEGURU….!

Learn Ruby in Next 30 Minutes

Right Now time is: 5:00 , Let’s complete this by 5:30

# This is all about ROR on print statements :

puts ‘Hello, World!’
puts ‘Hello world’+’how are you’

# how to format a string in ruby

puts “The number is %d” % [20]

# This is al about Variables and Multiline comments:

=begin
in order,
a string,
a boolean,
and a number
=end
aString = “I’m a string!”
aBoolean = true
aNumber = 42
afloatMaybe = 10.0
afraction_could_be = 25/5
puts “this is a flaot %d” % [afraction_could_be]

# This is all about “UGLY” Math we are doing with Ruby 😛 muhahahhaha

numberOne = 6
numberTwo = 8
numberThree = 5
numberFour = 12
numberFive = 36

testOne = numberTwo*numberThree #fill in the blank to make this 40
testTwo = numberFive-6*numberOne #fill in the blank to make this 0
testThree = numberFour-numberThree #fill in the blank to make this 7
if testOne == 40 && testTwo == 0 && testThree == 7
puts true
end

# Lots about string Manipulation and stuff as well.

myString = “Hi! I am code!” #In the next line, use methods to change it.
myNewString = [myString.upcase,myString.downcase,myString.reverse]
puts myNewString

# so much more about Arrays and processing:

myArray = [“Not me!”, “Not me!”, “Me!”, “Not me!”]
arr = [11,22,33,44,55]
arr.each_with_index {|val, index| puts “#{index >= 0 && index “this is my hash value 1″,”Mum”=>”this is my Hash value2”}
puts myFirstHash[“Dad”]

# This condition is all about If ELse and bla bla bla

language = “No Language”
if language === “English”
puts “Hello!”
elsif language === “Spanish”
puts “Hola!”
else
puts “this is the condition where all is well”
end

# unless, until and bla bla bla
#Make your loop below!
a = 2
b = 4
unless a>b
puts “omg!!!”
end

until a>b
puts “oye-hoyeeee”
end

# this is all about methods we need to know:

def methodname
puts “how to execute methods”
end

methodname()

For classes start from here:
https://www.tutorialspoint.com/ruby/ruby_classes.htm

OOPS it is still on. 😦

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: