Skip to content

Instantly share code, notes, and snippets.

Spesm

Block or report user

Report or block Spesm

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View ropasc.rb
def rock_paper_scissors
choice = ["Rock", "Paper", "Scissors"]
p_win = 0
c_win = 0
draw = 0
round = 0
puts ""
puts "Welcome to Rock, Paper, Scissors!"
puts "Please enter your name:"
name = gets.chomp
View pet.rb
class Pet
attr_reader :color, :breed
attr_accessor :name
def initialize(color, breed)
@color = color
@breed = breed
@hungry = true
end
View pet.rb
class Pet
attr_reader :color, :breed
attr_accessor :name
def initialize(color, breed)
@color = color
@breed = breed
@hungry = true
end
View pet.rb
class Pet
attr_reader :color, :breed
attr_accessor :name
def initialize(color, breed)
@color = color
@breed = breed
@hungry = true
end
View index.html
<!DOCTYPE html>
<html lang="en">
<!-- Head of document -->
<head>
<!-- Meta tags -->
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- Page title -->
<title>Sem van Lent</title>
View pet.rb
class Pet
attr_reader :color, :breed
attr_accessor :name
def initialize(color, breed)
@color = color
@breed = breed
@hungry = true
end
View cat.rb
class Cat
attr_reader :color, :breed
attr_accessor :name
# attr_writer :name
def initialize(color, breed)
@color = color
@breed = breed
@hungry = true
end
def feed(food)
View fav_foods.rb
def fav_foods
food_array = []
3.times do
puts "Name a favourite food."
food_array << gets.chomp
end
p food_array
puts "Your favourite foods are #{food_array.join(", ")}."
food_array.each do |food|
puts "I like #{food} too!"
View program4.rb
# 3.times do
# puts "Hello!"
# end
# 3.times do
# p "Hello! "
# end
# number = 0
# while (number <= 10) do
You can’t perform that action at this time.