-
Notifications
You must be signed in to change notification settings - Fork 45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hotel Cara Octo #40
base: master
Are you sure you want to change the base?
Hotel Cara Octo #40
Conversation
…r of rooms is reserved"
until i == @rooms.length || reservation_made == reservation.number_of_rooms | ||
|
||
if @rooms[i] == nil | ||
@rooms[i] = [] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could clean this up by creating one initial local variable equal to @rooms[i]
so you don't have to duplicate this everywhere
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So I would define @rooms[i] = [] as the default value in the initializer?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, something like this_room = @rooms[i]
and then use this_room
wherever you were previously using @rooms[i]
class Hotel | ||
attr_reader :rooms | ||
|
||
def initialize(rooms) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider renaming this variable to room_count
or something since right now it isn't clear what this variable would contain
HotelWhat We're Looking For
|
Hotel
Congratulations! You're submitting your assignment!
Comprehension Questions