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
class Cat | |
attr_reader :color, :breed | |
attr_accessor :name | |
def initialize(color, breed) | |
@color = color | |
@breed = breed | |
@hungry = true | |
end | |
def feed(food) | |
puts "Mmmmm, " + 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
var main =function() { | |
$('.btn').click(function() { | |
var post = $('status-box').val(); | |
$('<li>').text(post).prependTo('.posts'); | |
$('.status-box').val(''); | |
$('.counter').text('140'); | |
}); | |
$('.status-box').keyup(function() { | |
var postLength = $(this).val().length; | |
var charactersLeft = 140 - postLength; |
OlderNewer