This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def computerchoice | |
return rand(1..3) | |
end | |
$count_com = 0 | |
$count_you = 0 | |
def playgame | |
puts "What do you choose? paper= 1 /scissors= 2 /rock= 3" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
<title>SpaceX</title> | |
<!-- links --> | |
<link rel="stylesheet" type="text/css" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// START TWITTER FACEBOOK | |
!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0], | |
p=/^http:/.test(d.location)?'http':'https'; | |
if(!d.getElementById(id)){js=d.createElement(s); | |
js.id=id;js.src=p+'://platform.twitter.com/widgets.js'; | |
fjs.parentNode.insertBefore(js,fjs);}} | |
(document, 'script', 'twitter-wjs'); | |
(function(d, s, id) { | |
var js, fjs = d.getElementsByTagName(s)[0]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*START BODY*/ | |
body { | |
position: relative; | |
background-image:url(../img/background3.jpg) | |
} | |
/*END BODY*/ | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Pet | |
attr_reader :color, :breed | |
attr_accessor :name | |
def initialize(color, breed) | |
@color = color | |
@breed = breed | |
@hungry = true | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def fav_foods | |
food_array = [] | |
3.times do | |
puts "Name a favorite food." | |
food_array << gets.chomp | |
end | |
p food_array | |
puts "Your favorite foods are #{food_array.join(", ")}" | |
food_array.each do |food| | |
puts "I like #{food} too!" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# number = 0 | |
# while (number <= 10) do | |
# p "the number is now #{number}" | |
# number += 1 | |
# end | |
(0...10).each do |n| | |
p "the new number is #{n}" | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def choose | |
puts "Do you like programming? Yes, no, or maybe please." | |
choice = gets.chomp | |
case choice.downcase | |
when "yes" | |
puts "Thats\'s great!" | |
when "no" | |
puts "That\'s too bad!" | |
when "maybe" | |
puts "Glad you are giving it a chance!" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (5+5==10) | |
puts "this is true" | |
else | |
puts "this is false" | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
my_name = "Pascal" | |
def greeting | |
puts "Please enter your name:" | |
name = gets.chomp | |
puts "hello" + " " + name | |
end | |
greeting |
NewerOlder