Skip to content

Conversation

@rani-i3
Copy link

@rani-i3 rani-i3 commented Aug 29, 2023

No description provided.

cafe.rb Outdated
@@ -1,4 +1,5 @@
# frozen_string_literal: true
# require 'debug'
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

提出物からはコメントアウトでなくて消しましょう

cafe.rb Outdated
].freeze

def take_order(menus)
# binding.break
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

同上です。提出物からは消しましょう

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

修正しました。

cafe.rb Outdated
order2 = take_order(FOODS)

total = FOODS[order1][:price] + DRINKS[order2][:price]
total = FOODS[order2][:price].to_i + DRINKS[order1][:price].to_i
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

これでOKです。しかし本質的にはorder1,2のようなわかりにくい命名が引き起こしがちな不具合ともいえます。したがってよりよい解答としては変数名の見直しまでするといいですね。修正は任意で結構です。

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

修正しました!今のコードはorder1はdrinkorderになって、食べ物の分はfoodorderになりました。


puts 'bugカフェへようこそ!ご注文は? 番号でどうぞ'
order1 = take_order(DRINKS)
drinkorder = take_order(DRINKS)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

細かいことをいうとスネークケースで書いたほうがいいのでdrink_orderが適切ですね


puts 'フードメニューはいかがですか?'
order2 = take_order(FOODS)
foodorder = take_order(FOODS)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

同上です。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants