The part of the if statement below is called a hypothesis, the latter part is called a conclusion.
2 Conditional statements are reverse combinations of conditional statements and if and if formats.
This is a combination of two conditional statements "If two line segments match, their lengths are the same", "they match if the lengths of the two line segments are equal".
Definition: The conditional statement represented by pq is an if-then statement. Where p is the hypothesis and q is the conclusion. Logical connectors of conditional statements are represented by symbols. The condition is defined as true unless the true hypothesis leads to false conclusions. The truth table for pq is shown below. Answer: In Example 1, the sentence "I do my homework" is a hypothesis and the sentence "I get my benefit" is a conclusion. Therefore, the condition pq represents the hypothesis that "if you do homework you will receive a grant." However, as you can see from the above truth table, grant is not guaranteed even if you do homework. In other words, there is not always a causal relationship between the hypothesis and the conclusion of the conditional statement.
Conditional statements are not causal sentences. The important difference is that the causal statement requires that the antecedent precedes or matches the time and that the conditional statement does not require this chronological order. Because there is a possibility that various English sentences are displayed in the form of "if ..., then ..." (Since this form is generally used to express causality, You can), in many cases confusing. . However, these two statements are completely different.
Please use unnecessary conditional statements and temporary variables. Each if statement is a logical branch that requires at least two tests. If you can avoid this condition without sacrificing readability, you should do so. The main problem with this problem is not to introduce another function, but to expand the function using branch logic. Whenever you think you need an if statement or a new function variable, you should ask yourself: Should I change the code at the right level or should I consider the problem at a higher level?