Commit a39e979e by The Vien Pham

addModule_2_3

parent 3f56d409
...@@ -83,15 +83,9 @@ end ...@@ -83,15 +83,9 @@ end
path = "/home/nhib/Desktop/my-git-repo/Ruby-Training/test.txt" path = "/home/nhib/Desktop/my-git-repo/Ruby-Training/test.txt"
comics = load_comics(path) comics = load_comics(path)
Popup.make do
h1 "Things to do"
list do
p "Try out ruby"
p "Ride a tiger"
P "(down River Euphrates)"
end
end
puts "----------------- level 6 is done -------------------------" puts "----------------- level 6 is done -------------------------"
print "\n" print "\n"
string_array = [1,2,3,4,5,6,7]
puts string_array[4]
#Exercise UNIT 1: INTRODUCTION TO RUBY
=begin
rescue Exception => e
end
puts my_num = 25
puts my_boolean = "Check false or true? wtf"
puts my_string = "My name is bla bla..."
print "What's is your name: "
first_name = gets.chomp
print "What's is last name: "
last_name = gets.chomp
puts "Your name is #{first_name} #{last_name}"
my_dog = "Haha"
puts "I took #{my_dog} to the zoo"
=end
#UNIT 2: CONTROL FLOW IN RUBY
print "Integer input please: "
user_enum = Integer(gets.chomp)
if user_enum < 0
puts "You picked a negative Integer"
elsif user_enum > 0
puts "You picked a positive Integer"
else
puts "You picked zero"
end
if 1 > 2
puts "right"
else
puts "wtf?!"
end
# boolean_1 = (3 < 4 || false) && (false || true)
boolean_1 = true
# boolean_2 = !true && (!true || 100 != 5**2)
boolean_2 = false
# boolean_3 = true || !(true || false)
boolean_3 = true
problem = false
puts "GOod to go" unless problem
=begin
print "What's you want to input this here my user: "
user_input = gets.chomp
user_input.downcase!
if user_input.include? "s"
user_input.gsub!(/s/,"th")
else
puts "Not have S in your string"
end
puts "Actually input above: " + "#{user_input}!"
=end
=begin
i = 0
while i < 5
puts i
i = i + 1
end
=end
=begin
j = 0
until j == 5
j += 1
end
puts j
=end
#for
=begin
for num in 1..15
puts num
end
=end
#The loop method
=begin
i = 0
loop do
i += 1
print "#{i}"
break if i > 5
end
=end
=begin
odds = [1,3,5,7,9]
odds.each do |x|
x *= 2
puts x
end
=end
10.times {print "chunky bacon!"}
=begin
m = 0
loop do
m += 1
print "RUBY!"
break if m == 30
end
=end
=begin
puts "Text to search through: "
text = gets.chomp
puts "Word to redact: "
redact = gets.chomp
words = text.split(" ")
words.each do |word|
if word != redact
print word + " "
else
print "REACTED"
end
end
my_2d_array = [["string",false,"125"],[true,"string","50"],["102","vien","pham"]]
my_2d_array.each do |x|
print "#{x}\n"
end
=end
lunch_order = {
"Ryan" => "wonton soup",
"Eric" => "hamburger",
"Jimmy" => "sandwich",
"Sasha" => "salad",
"Cole" => "taco"
}
lunch_order.each do |x,y|
puts "#{x}" + "#{}"
end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment