All pastes #369700 Raw Edit

Mine

public text v1 · immutable
#369700 ·published 2007-02-24 00:12 UTC
rendered paste body
=begin
  Well, here goes my first attempt at anything code related. I'm
  fairly sure I have no idea what I'm doing, and from class variables 
  on down, I don't even have a guess as to what the stuff after the =
  means, so I apologize if it's all nonsense. XD
=end

# Okay, local variables first. Let's see if I can do this right.
cookies_in_the_jar = 10
favorite_color = 'blue'

# Now for some instance variables
@color = Color.new(0, 0, 0, 0)
@name = 'Stuff'

# Class variables. 
@@number_of_sheep = 20
@@sheep_in_the_pen = 0

# Global variables.
$global_variable1 = 'I have no idea what this text does'
$global_variable2 = Cow

# Constants.
CONSTANT1 = More stuff
CONSTANT2 = Even more stuff

# P function. This is where I was a bit lost, so I'll probably flub 
# this part. Does it just copy whatever variable you list?

p favorite_color    -> blue
p @name    -> stuff
p @@number_of_sheep    -> 20

# Print Function. I don't really see the difference between the two,
# and I don't understand this one any better than the last. >.>;

print cookies_in_the_jar    -> 20
print CONSTANT2    -> Even more stuff
print $global_variable2    -> Cow

=begin
  That was...confusing at best, but that probably has more to do with
  the fact that I was making it more complicated than it had to be. I'm
  not entirely sure I did what I was supposed to, but I'm looking 
  forward to future lessons, and hopefully it'll start falling into 
  place.
=end