if-switch

title: "courses/c-course - if-switch.md"

- **fileName**: if-switch
- **Created on**: 2024-06-06 14:08:14

if condition

for check for something and if the condition is done then do the inside {}

Example
```

	if (username == "yossef") {
		printf("wlcome mr, yossef");
	};
and there is else if and else this work like if work don't done then check for else if (if there is if else) and if not done else check for the second else if and now if all if don't done and else if the go to else and it's working if there is no if or else if done

Example

	if (age < 10) {
		printf("user age is less than 10");
	}else if(age > 10 AND age < 50) {
		printf("user age is greater than 10");
	}else {
		printf("user age is greater than 50");
	}
	if (age < 10) printf("user age is less than 10");
	else if(age > 10 AND age < 50) printf("user age is greater than 10");
	else printf("user age is greater than 50");

switch case

should i use if or switch don't care there is no big difference

example for switch

	char mark = 'a';
	switch (mark) {
		case 'a':
			printf("nice work - exclient");
			break;
		case 'b':
			printf("very good");
			break;
		case 'c':
			printf("good");
			break;
		case 'd':
			printf("you'r barlay sucess");
			break;
		case 'f':
			printf("you fail");
			break;
	};

continue: string.h.md

before: formated-string.md