if else statement
IF else statement in php in hindi:-
If Else statement किसी भी programming language का सबसे important feature है , PHP If Else conditions के according किसी Code Of Block को run करने के लिए use होता है। Means जब हमें Condition True होने पर कोई दूसरा code run करना हो Condition गलत होने पर कुछ और तब हम If Else का use करते हैं।
तो ऊपर दिए गए example में आप देख सकते हैं की PHP में If Else किस तरह से use करते हैं। हालांकि PHP में if या else के साथ use होने वाले curly brackets {} की जगह आप colon : भी use कर सकते हैं।
जब हम किसी project / website develop करते हैं , तो हमें PHP को दूसरी languages (HTML, CSS , JavaScript , j Query etc .) के साथ एक्सेक्यूटे करना पड़ता हैं , इस कंडीशन में कुछ इस तरह से हम If Else use करते हैं।
तो इस तरह से हम If Else Statement के साथ HTML को use करते हैं। Example में मैंने एक undefined variable $condition check किया है हालाँकि यह undefined है इसलिए condition False है
elseif / else if जैसा की नाम से पता चलता है कि अगर upper condition condition false होती है और elseif में दी हुयी condition true return करती है तो elseif code of block run होगा। हालाँकि if के बाद यह जरूरी नहीं की एक ही elseif use हो Condition के according एक से ज्यादा भी use हो सकते हैं।
दिए गए Example में आप देख सकते हैं कि किस तरह से आप elseif Use कर सकते हैं। हालाँकि elseif को एक साथ लिखने की जगह else if दो शब्दों में अलग अलग भी लिख सकते हैं।
दिए गए Example में आप देख सकते हैं कि किस तरह से आप elseif Use कर सकते हैं। हालाँकि elseif को एक साथ लिखने की जगह else if दो शब्दों में अलग अलग भी लिख सकते हैं।
if else java:-
In Java, the "if-else" statement is a control structure that allows you to execute a block of code if a condition is true, and another block of code if the condition is false. The basic syntax for an "if-else" statement in Java is as follows:
if (condition)
{
// Code to execute if the condition is true}
else
{ // Code to execute if the condition is false}
Here's an example of how to use an "if-else" statement in Java to determine whether a number is positive or negative:
int number = -10;
if (number >= 0)
{
System.out.println("The number is positive");}
else
{
System.out.println("The number is negative");}
In this example, if the value of "number" is greater than or equal to 0, the program will output "The number is positive." Otherwise, it will output "The number is negative.
python if else:-
In Python, the "if-else" statement is a control structure that allows you to execute a block of code if a condition is true, and another block of code if the condition is false. The basic syntax for an "if-else" statement in Python is as follows:
if condition:
# Code to execute if the condition is trueelse:
# Code to execute if the condition is falseHere's an example of how to use an "if-else" statement in Python to determine whether a number is positive or negative:
number = -10if number >= 0:
print("The number is positive")else:
print("The number is negative")
In this example, if the value of "number" is greater than or equal to 0, the program will output "The number is positive." Otherwise, it will output "The number is negative."
No comments