Skip to content

Instantly share code, notes, and snippets.

@McLarenCollege
Last active December 21, 2021 11:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save McLarenCollege/b3b45cfafe40b5065fe2d72419bf7067 to your computer and use it in GitHub Desktop.
Save McLarenCollege/b3b45cfafe40b5065fe2d72419bf7067 to your computer and use it in GitHub Desktop.
Exercise Name : Cinema Hall If-Else

A cinema is showing movie to childeren (age < 18) for free and charging adults (age >= 18) with $10 per ticket.

Write if-else statements to print the following messages according to the given age.

For adults print the following messages to the console:

Please pay $10.
Please proceed to the cinema hall.

For children print the following message to the console:

Please proceed to the cinema hall.

CODE TEMPLATE


let age = 34;
// write your if else statement here to print the required messages 
// according to the value of the age variable

For your reference here is the structure of an if-else statement

if(boolean expression) {
  // execute this block if the boolean expression 
  // evaluated to true
}
else {
  // execute this block if the boolean expression 
  // evaluated to false
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment