Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Learn you the ruby for awesome power samples
print (1..10).sum
00110001 00000000 00000000
00110001 00000001 00000001
00110011 00000001 00000010
01010001 00001011 00000010
00100010 00000010 00001000
01000011 00000001 00000000
01000001 00000001 00000001
00010000 00000010 00000000
01100010 00000000 00000000
total = 0
count = 1
while count <= 10
total += count
count += 1
end
public class HelloWorld {
public static void main(String[] args) {
System.out.println("Hello, World");
}
}
print 'Hello, World'
#!/usr/bin/env ruby
author = "Kurtis Rainbolt-Greene"
# created: 2010.09.14-19:21:17
# encoding: utf-8
puts "A Boy And His Dog"
puts "================="
puts "It was a cold winter morning in the Forgotten Valley."
puts 'The boy looked to his dog and said, "Look there, Lucky!"'
puts '"The Temple of Golden Arches!" The dog glumly barked.'
puts "Venturing forth they climb down from the mountainside."
puts '"We are sure to find lost treasure!"'
puts 'The abandoned temple to the Golden Arches awaited.'
#!/usr/bin/env ruby
author = "Kurtis Rainbolt-Greene"
# created: 2010.09.09 21:13:07
# encoding: utf-8
# This line is a comment. A comment is used to
# document source code. This makes it easier to
# read for others, and yourself.
puts "The Wealthiest Merchant And His Daughter"
puts "========================================"
# Any part of a line after the pound sign is a comment, and not interpreted.
puts "The boy and his lucky dog travelled along the wasteland together." # Like this.
puts "They saw many things, but mostly trash and death." # These are comments
puts "The adventurous two wandered through abandoned cities and towns."
# puts "Avoiding raiders and wastelanders." # This is line is a comment.
print "One time the two happened on a small village named "
puts '"Wall Mart Town"'
### You can put multiple pound signs, but it doesn't read anything after the
## first pound sign. ##
# You can even indent the comments!
print "\"Hey Lucky,\" the boy says"
print " "
puts "\"Lets check this place out!\""
puts "The dog didn't think this was a good idea."
#!/usr/bin/env ruby
author = "Kurtis Rainbolt-Greene"
# created: 2010.09.13-17:19:18
# encoding: utf-8
puts "Preparing For The Market And The Wasteland"
puts "=========================================="
puts "The boy looked over his belongings before entering the market."
# A little intro to interpolation.
puts "He had found #{4 + 9} shotgun slugs and #{3 - 2} MRE."
puts "The lucky dog could smell the #{10 * 3 - 2 - 10} packets of salt."
puts "The boy wondered how much ammo he could get from the merchant!"
# This next line shows a math equation.
puts 4 + 2 * ( 100 % 2 ) / 4 + ( ( 4 + 2 ) * 4 )
# Now let's check out some Boolean Operators! Yay!
puts "Twenty eight whole bullets! The boy needs it to last ten days, at 2 per day."
puts "The boy and his lucky dog has enough, right? #{28 / 2 >= 10}"
puts "Does the boy have enough for twenty days? #{28 / 2 > 20}"
puts "What about less than 15 days? #{28 / 2 < 15}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.