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 Pokemon | |
# from here until line 9, we are INSIDE the class | |
# when a Pokemon is created, its name, type, and level must be set | |
def initialize(name, type, level) | |
@name = name | |
@type = type | |
@level = level | |
end | |
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
class Pokemon | |
# from here until line 9, we are INSIDE the class | |
attr_accessor :name, :type, :level | |
# when a Pokemon is created, its name, type, and level must be set | |
def initialize(name, type, level) | |
@name = name | |
@type = type | |
@level = level | |
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
class LinkedListNode | |
attr_accessor :value, :next | |
def initialize(value) | |
@value = value | |
@next = nil | |
end | |
def kth_to_last_node(k, head) |
OlderNewer