Recap - Variable Creation
Part of the Fundamentals section of Coddy's Ruby journey — lesson 10 of 88.
Challenge
EasyCreate variables representing different aspects of a product inventory system. You need to create exactly four variables, each with a different data type.
First, create a variable called product_price and assign it the value 29.99. Then create a variable called item_count and assign it the value 150. Next, create a variable called product_name and assign it the value "Wireless Headphones". Finally, create a variable called in_stock and assign it the value true.
After creating all four variables, display each one using the puts command in this exact order: product_price, item_count, product_name, and in_stock.
Try it yourself
# TODO: Create the four variables with their assigned values
# TODO: Display each variable using puts command in the specified orderAll lessons in Fundamentals
4Operators Part 2
Logical Operators Part 1Logical Operators Part 2Recap - Simple LogicLogical Operators Part 3Logical Operators Part 42Variables and Data Types
Numbers and VariablesString Data TypeBoolean Data TypeSymbol Data TypeChecking Data TypesNaming ConventionsRecap - Variable Creation8Loops
For Loop with RangesWhile LoopBreakNextRecap - FactorialTimes LoopUntil LoopNested LoopsRecap - Dynamic Input3Operators Part 1
Arithmetic OperatorsModulo OperatorArithmetic ShortcutsRecap - Simple MathComparison Operators6Basic IO
Output with putsOutput with print and pOutput With VariablesInput with getsChomp MethodType ConversionRecap - Age CalculatorRecap - True or False