Podcast
Questions and Answers
Conditional statements are useful for writing ______ making logic
Conditional statements are useful for writing ______ making logic
decision
The if statement executes some code if one condition is ______
The if statement executes some code if one condition is ______
true
The if...else statement executes some code if a condition is true and another code if that condition is ______
The if...else statement executes some code if a condition is true and another code if that condition is ______
false
The if...elseif...else statement executes different codes for more than two ______
The if...elseif...else statement executes different codes for more than two ______
Signup and view all the answers
PHP conditional statements are implemented by the following ______
PHP conditional statements are implemented by the following ______
Signup and view all the answers
Use the ______ statement to select one of many blocks of code to be executed. SYNTAX: ______ (n) { case label 1: code to be executed if n=label 1; break; case label 2: code to be executed if n=label 2; case label 3: code to be executed if n=label 3; … default: code to be executed if n is different from all labels; }
Use the ______ statement to select one of many blocks of code to be executed. SYNTAX: ______ (n) { case label 1: code to be executed if n=label 1; break; case label 2: code to be executed if n=label 2; case label 3: code to be executed if n=label 3; … default: code to be executed if n is different from all labels; }
Signup and view all the answers
Conditional ______ are used to perform different actions based on different conditions. Activity #5 write a program to check student grade based on marks whether A+, A, B, C, D grade or fail in PHP. Example: User input: 76 Output : D grade
Conditional ______ are used to perform different actions based on different conditions. Activity #5 write a program to check student grade based on marks whether A+, A, B, C, D grade or fail in PHP. Example: User input: 76 Output : D grade
Signup and view all the answers
Activity #5 write a program to check student grade based on marks whether A+, A, B, C, D grade or fail in PHP. Example: User input: 76 Output : D grade NEXT TOPIC: LOOPING STRUCTURE PHP LOOPS.
Activity #5 write a program to check student grade based on marks whether A+, A, B, C, D grade or fail in PHP. Example: User input: 76 Output : D grade NEXT TOPIC: LOOPING STRUCTURE PHP LOOPS.
Signup and view all the answers
If( 1st condition) { Execute statement(s )if condition is true; } { ______( 2nd condition )Execute statement(s) if 2nd condition is true; }Else{ Execute statement(s) if both conditions are false; }
If( 1st condition) { Execute statement(s )if condition is true; } { ______( 2nd condition )Execute statement(s) if 2nd condition is true; }Else{ Execute statement(s) if both conditions are false; }
Signup and view all the answers
The switch statement is used to ______ different actions based on different conditions. Use the switch statement to select one of many blocks of code to be executed. SYNTAX: switch (n) { case label 1: code to be executed if n=label 1; break; case label 2: code to be executed if n=label 2; case label 3: code to be executed if n=label 3; … default: code to be executed if n is different from all labels; }
The switch statement is used to ______ different actions based on different conditions. Use the switch statement to select one of many blocks of code to be executed. SYNTAX: switch (n) { case label 1: code to be executed if n=label 1; break; case label 2: code to be executed if n=label 2; case label 3: code to be executed if n=label 3; … default: code to be executed if n is different from all labels; }
Signup and view all the answers
Study Notes
Conditional Statements
- Conditional statements are useful for writing logic making code
- If statements execute some code if one condition is true
- If...else statements execute some code if a condition is true and another code if that condition is false
- If...elseif...else statements execute different codes for more than two conditions
Switch Statements
- PHP conditional statements are implemented by the following: if, if...else, if...elseif...else, and switch statements
- The switch statement is used to perform different actions based on different conditions
- Syntax for switch statement: switch (n) { case label 1: code to be executed if n=label 1; break; ... default: code to be executed if n is different from all labels; }
PHP Program Example
- Example program to check student grade based on marks: A+, A, B, C, D grade or fail
- User input: 76, Output: D grade
- If statements can be used to check conditions and execute specific code blocks based on the conditions
Conditional Statement Syntax
- If statement syntax: If( 1st condition) { Execute statement(s) if condition is true; } { elseif( 2nd condition )Execute statement(s) if 2nd condition is true; } Else{ Execute statement(s) if both conditions are false; }
Studying That Suits You
Use AI to generate personalized quizzes and flashcards to suit your learning preferences.
Related Documents
Description
Test your understanding of PHP conditional statements with this quiz. Explore the importance of conditional statements, different types available in PHP, and their application in creating website logic.