Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Greeting Functions #17

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Lsimmons98
Copy link

No description provided.

let scuberGreeting
if(rideDistance <= 400){
scuberGreeting = 'This one is on me!'
}else if(rideDistance > 400 && rideDistance < 2000){

Choose a reason for hiding this comment

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

You can exclude rideDistance > 400 && since it's already covered by the first part of the conditional.

Suggested change
}else if(rideDistance > 400 && rideDistance < 2000){
}else if(rideDistance < 2000){

Comment on lines +1 to +12
function scuberGreetingForFeet(rideDistance){
let scuberGreeting
if(rideDistance <= 400){
scuberGreeting = 'This one is on me!'
}else if(rideDistance > 400 && rideDistance < 2000){
scuberGreeting ='That will be twenty bucks.'
}else if(rideDistance < 2500 && rideDistance > 2000){
scuberGreeting = 'I will gladly take your thirty bucks.'
}else if (rideDistance > 2500){
scuberGreeting = 'No can do.'
}
return scuberGreeting

Choose a reason for hiding this comment

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

I know it seems trivial, but consistent spacing that follows the "standards" is important for readability.

Suggested change
function scuberGreetingForFeet(rideDistance){
let scuberGreeting
if(rideDistance <= 400){
scuberGreeting = 'This one is on me!'
}else if(rideDistance > 400 && rideDistance < 2000){
scuberGreeting ='That will be twenty bucks.'
}else if(rideDistance < 2500 && rideDistance > 2000){
scuberGreeting = 'I will gladly take your thirty bucks.'
}else if (rideDistance > 2500){
scuberGreeting = 'No can do.'
}
return scuberGreeting
function scuberGreetingForFeet(rideDistance){
let scuberGreeting
if (rideDistance <= 400) {
scuberGreeting = 'This one is on me!'
} else if (rideDistance > 400 && rideDistance < 2000) {
scuberGreeting ='That will be twenty bucks.'
} else if (rideDistance < 2500 && rideDistance > 2000) {
scuberGreeting = 'I will gladly take your thirty bucks.'
} else if (rideDistance > 2500) {
scuberGreeting = 'No can do.'
}
return scuberGreeting

Comment on lines +20 to +33
let tipGreeting;
switch(tip){
case 'generous' :
tipGreeting = 'Thank you so much.'
break;
case 'not as generous' :
tipGreeting = 'Thank you.'
break;
default:
tipGreeting = 'Bye.'
}
return tipGreeting
}

Choose a reason for hiding this comment

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

Here's an easy way to clean this up:

function switchOnCharmFromTip(tip){
  switch(tip){
    case 'generous':
      return 'Thank you so much.'
    case 'not as generous':
      return 'Thank you.'
    default:
      return 'Bye.'
  }

scuberGreeting ='That will be twenty bucks.'
}else if(rideDistance < 2500 && rideDistance > 2000){
scuberGreeting = 'I will gladly take your thirty bucks.'
}else if (rideDistance > 2500){

Choose a reason for hiding this comment

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

Same idea here... this isn't need since it's already covered.

Suggested change
}else if (rideDistance > 2500){
} else {

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