If-else statements
📖 Scenario: You are helping a small shop owner decide if a product is affordable for customers based on its price.
🎯 Goal: Build a simple R program that uses if-else statements to check if a product price is affordable or expensive compared to a set budget.
📋 What You'll Learn
Create a variable with the product price
Create a variable with the budget limit
Use an if-else statement to compare the price with the budget
Print 'Affordable' if the price is less than or equal to the budget
Print 'Expensive' if the price is greater than the budget
💡 Why This Matters
🌍 Real World
Shop owners often need to check if product prices fit within customer budgets to decide promotions or discounts.
💼 Career
Understanding if-else statements is essential for programming logic used in data analysis, automation, and decision-making tasks.
Progress0 / 4 steps