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 welcome | |
puts " | |
Hi, wanna play \"Rock, Paper, Scissor\"? (y/n)" | |
$score = [0, 0] | |
init(gets.chomp.split("").first.downcase) | |
end | |
def init(answer = "") | |
if (answer == "y") | |
puts " Cool. You know the rules?" |
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 | |
def feed(food) | |
puts "Mmmm, "+food+"!" |
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 | |
puts "Your favorite foods are #{food_array.join(", ")}." | |
end | |
fav_foods |
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
3.times do | |
puts "Hello!\n" | |
end | |
number = 0 | |
while (number <= 10) do | |
p "the number is now #{number}" | |
number += 1 | |
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?" | |
choice = gets.chomp | |
if (choice.downcase == "yes" || choice.downcase == "yep" ) | |
puts "Cool, me too!" | |
elsif (choice.downcase == "no") | |
puts "Too bad. Get lost!" | |
else | |
puts "I have no idea, what you just said." | |
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?" | |
choice = gets.chomp | |
if (choice.downcase == "yes") | |
puts "Cool, me too!" | |
elsif (choice.downcase == "no") | |
puts "Too bad. Get lost!" | |
else | |
puts "I have no idea, what you just said." | |
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 greeting | |
puts "Please enter your name:" | |
name = gets.chomp | |
puts "Hi there, "+name+", 'ssup?" | |
end | |
greeting |
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
var calcStr = ""; // computation String as such - to be eval()uated at the end. | |
var calcDec = false; // toggle for checking if decimal point is set | |
var calcDone = false; // toggle for checking eval() | |
var operand = []; // collecting operands -> dataGathering() | |
var numbers = []; // collecting numbers -> dataGathering() | |
function dataGathering(a){ | |
if (calcStr) { | |
numbers.push(parseFloat(calcStr)); |
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
#calculator { | |
font-family: monospace; | |
width: 320px; | |
height: 400px; | |
margin: 10px auto; | |
border: 5px solid #555; | |
padding: 5px; | |
border-radius: 10px; | |
background-color: #ddd; | |
} |
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 lang="en"> | |
<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>FutureDev's Calculator</title> | |
<link rel="stylesheet" href="css/normalize.css"> | |
<link rel="stylesheet" href="css/styles.css"> |
NewerOlder