Computer Science, asked by nancyyy, 1 year ago

differentiate between if and switch statements?

Answers

Answered by Anonymous
8

Hey there!





-- if statement

  • It is used to control the flow of execution of statements in a program based on some conditions or abruptly.
  • It a a two-way decision making statement.
  • It has two paths to follow : (1) True condition (2) False condition.




-- Switch Statement

  • It is a multiple way decision making statement.
  • It compare with each case value until a match is found, or default, or end is encountered, if the matching is found the execution continues with its statement and goes sequentially forward.
  • In this, we can use int, long and char data types for integral expression.
Similar questions