From 37318fa8da2ed0339955b66b3ba14f0ef8e29602 Mon Sep 17 00:00:00 2001 From: NirvashPrime <37520562+NirvashPrime@users.noreply.github.com> Date: Mon, 15 Oct 2018 23:59:38 -0400 Subject: [PATCH] Revised formatting and added information (#19431) Revised formatting to follow PSR, included additional examples, added multiple conditions with logical operators, and added a reference to ternary operators. --- .../english/php/if-else-statement/index.md | 90 ++++++++++++------- 1 file changed, 60 insertions(+), 30 deletions(-) diff --git a/client/src/pages/guide/english/php/if-else-statement/index.md b/client/src/pages/guide/english/php/if-else-statement/index.md index cae0c8bb2a..760b0f0e0d 100644 --- a/client/src/pages/guide/english/php/if-else-statement/index.md +++ b/client/src/pages/guide/english/php/if-else-statement/index.md @@ -2,65 +2,95 @@ title: If-else Statement --- ## Introduction -If/Else is a conditional statement where depending on the truthiness of a condition, diffierent actions will be performed. +If/Else is a conditional statement where depending on the truthiness of a condition, different actions will be performed. -> **Note:** The `{}` brackets are only needed if the condition has more than one action statement. +> **Note:** The `{}` brackets are only needed if the condition has more than one action statement; however, it is best practice to include them regardless. ## If Statement -~~~~ - if (condition){ + +``` + **Note:** The `else` statement is optional. ## If/Else Statement -~~~~ - if (condition){ + +``` + **Note:** `elseif` should always be written as one word. ## If/Elseif/Else Statement -~~~~ - if (condition1){ + +``` +PHP Else +## Multiple Conditions + +Multiple conditions can be used at once with the "or" (||), "xor", and "and" (&&) logical operators. + +For instance: + +``` +