Skip to content

Guavalines/rails-stupid-coaching

Repository files navigation

🏀 STUPID COACHING

Description

This project is an app that uses conditional and looping structures to modify program flow and responds to user input based on the entered message. The app has a controller that includes if/else statements to modify the program flow and provide appropriate responses to user messages. The app is designed to respond differently based on the type of message entered, such as a statement or a question, and provides specific responses based on the input.

Features

  • conditional and looping structures
  • execution flow and control structures that modify the program flow (ie if/unless...else...end, while/until...end).

Views

The idea is that when you enter a message and click the "talk" button, Coach Hell responds with a message of his own, based on your message.

Question

When you enter a question such as "Do I have to work?", Coach Hell responds...

QuestionResponse

When you enter a statement such as "I'm tired", Coach Hell responds...

StatementResponse

However, when you enter "I'm going to work", Coach Hell responds...

Great

Here is the code for the controller, which shows the if/else statements that modify the program flow:

class CommunicationsController < ApplicationController
  def ask; end

  def answer
    @talk = params[:talk]
    if @talk == "I'm going to work"
      @answer = 'Great!'
    elsif @talk.end_with?('?')
      @answer = 'SILLY QUESTION! GET DRESSED AND GO TO WORK!'
    else
      @answer = "I DON'T CARE, GET DRESSED AND GO TO WORK!"
    end
  end
end

Initialize these before starting the app:

Versions

Ruby 3.0.3

Ruby on Rails 7.0.2.2

Setup

 git clone [email protected]:guavalines/rails-stupid-coaching.git
 cd rails-stupid-coaching
 rails db:create db:migrate db:seed:replant
 bundle install
 yarn install
 rails server

Open your browser and visit localhost:3000

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published