Congratulations on making it to the end of this course! It's time put your newfound knowledge to the test by completing a coding exercise. Below, an embedded REPL is provided for you. Rather than coding inside this lesson, though, we recommend you open the REPL on REPL.it by clicking the link in the upper right corner.
<iframe height="400px" width="100%" src="https://repl.it/@MaxwellBenton2/yale-web-development-bootcamp-2020-technical-submission?lite=true" scrolling="no" frameborder="no" allowtransparency="true" allowfullscreen="true" sandbox="allow-forms allow-pointer-lock allow-popups allow-same-origin allow-scripts allow-modals"></iframe>When you start to edit the REPL, you may be prompted to sign-in. Editing will create a copy of the REPL under your personal account.
In the REPL, click app.rb
. This is where you will write your code. Comments are provided to indicate where to start typing. Your task
is to do the following in app.rb
:
- Create a local variable called
name
and set it equal to a string of your name. - Create a local variable called
age
and set it equal to an integer of your age. - Create a local variable called
favorite_food
and set it equal to a string of your favorite food. - Create a local variable called
height_in_inches
and set it equal to an integer of your height in inches. (HINT: If you're 7 feet tall, this should be 84) - Create a variable caleld
height_message
using the ternary operator. If your height in inches is greater than average, the message should say "You are taller than average." Otherwise, it should say "You are not taller than average."
When you're done, you can test your code by running ruby app.rb
from the provided Terminal in the REPL. You should see an output message from the computer. Then complete the official grading tests by typing rspec
. Once you get all tests passing, click the upper right corner of the REPL to open in REPL.it. You'll be brought to your version of the REPL. Copy the URL and submit it to your instructor. Good luck!