Skip to content

Conversation

@OhCloud
Copy link

@OhCloud OhCloud commented Aug 12, 2019

Calculator

Congratulations! You're submitting your assignment.

Comprehension Questions

Question Answer
What went well in your code style, such as indentation, spacing, variable names, readability, etc.? What was lacking? i think indentation is ok.
How did your code keep track of user input? by storing things in variables.
How did your code determine what operation to perform? dependent on user input
What opportunities exist to create small methods for this project? for all of the methods.
In the next project, what would you change about your process? What would you keep doing? i think this way works well.

@OhCloud OhCloud changed the title Create leaves - cloudy Leaves - Cloudy Aug 12, 2019
end

puts 'please input the first number'
num1 = gets.chomp.to_i

Choose a reason for hiding this comment

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

This allows for silly input like this:

Please choose a name or a symbol from the list below:
        1. add(+)
        2. subtract(-)
        3. multiply(*)
        4. divide(/)
add
please input the first number
jfdskal;dfjlsa
please input the second number
fjdkaljfdslkajkfadls
awesome, your total is 0! whooo.

You need to do a liiittle more work to get this to work the way you expect.

puts "please enter real number"
num2 = gets.chomp.to_i
end
end

Choose a reason for hiding this comment

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

Indentation got a bit goofed here, probably because this is a txt rather than a ruby file?

if operation == 'divide' || operation == '/'
while num2 == 0
puts "please enter real number"
num2 = gets.chomp.to_i

Choose a reason for hiding this comment

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

nice job changing num2 before printing.

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