conditional statements

0.0(0)
Studied by 0 people
call kaiCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/14

encourage image

There's no tags or description

Looks like no tags are added yet.

15 Terms

1
New cards

Statement

Is an instruction that the compiler or interpreter executes.

typically performs an action such as declaring a variable, performing a

calculation, or making decisions.

2
New cards

Declaration statement

Used to declare variables and allocate memory for them.

Defines the data type of a variable and optionally initializes it.


used when getting input from user

3
New cards

Expression statement

Expression that is evaluated


Performs an action such as assigning value to variable, invoking a method call (writeline, write, readline), or performing arithmetic ops (inc / dec)

4
New cards

Control flow statement

Allow you to dictate the flow of execution in a program based on conditions or loops

5
New cards

Conditional and repetition

Two types of control flow statement

6
New cards

Conditional statement

Allow the program to execute certain parts of code based on whether a condition is true or false

7
New cards

If statement

statement that executes if true

8
New cards

Else statement

A code executes if the statement is true, otherwise false

9
New cards

If else if

Checks multiple conditions in sequence

Executes code block for the first true and skipping the rest

used when gusto ng maraming conditions

<p><span style="color: rgb(244, 158, 14);">Checks multiple conditions in sequence</span></p><p class="has-focus"><span style="color: rgb(244, 158, 14);">Executes code block for the first true and skipping the rest</span></p><p class="has-focus"><span style="color: rgb(244, 158, 14);">used when gusto ng maraming conditions</span></p>
10
New cards

Nested conditional

Are if statements placed inside another if or else statement to create more complex decision-making logic

<p><span style="color: rgb(255, 168, 0);">Are if statements placed inside another if or else statement to create more complex decision-making logic</span></p>
11
New cards

conditional ternary operator

short term of if-else

for simple conditions, not complex logic

<p><span style="color: rgb(255, 160, 0);">short term of if-else</span></p><p><span style="color: rgb(255, 160, 0);">for simple conditions, not complex logic</span></p>
12
New cards

switch

statement to select one of many code blocks to be executed.

marami choices

13
New cards

block statement

is a group of statements enclosed in curly braces { }.

It allows you to execute multiple statements together as a single unit.

often used in control flow statements (like if, for, while, etc.) to group multiple statements that should be executed when the condition is met.

14
New cards

declaration, expression, control flow, block

4 types of statements

15
New cards

if, else, if else if, switch, nested conditional, conditional ternary operator

6 types of conditional statements