4/4 All Together Now!


#1






<?php
if (this condition is true) {
echo "The condition is true";
}
else {
echo "The condition is false";
}
?>



Oops, try again. It looks like you didn't print anything!

Parse error: syntax error, unexpected T_STRING on line 7

What did I do wrong?


#2

take at look at you code below with some comments

<?php
	//thats right you have the right idea here
	//whatever goes inside the parenthesis must evaluate to true
	//however you have to follow language semantics
	//you have to put a statement(that follows the right syntax)
	//that will evaluate to true
	//the condition you put here is wrong syntatically
	// some correct expressions will be
	//3<7 -->> true or "cat".length == 3 -->> true
	if (this condition is true) {
		echo "The condition is true"; 
	}
	else {
		echo "The condition is false"; 
	}
?>

Now here is s suggestion on how to write the code

<?php
       //this code will print the -->>"The condition is true"<<--
	if (3<7) {
		echo "The condition is true"; 
	}
	else {
		echo "The condition is false"; 
	}
?>

but

<?php
        //this code will print the -->>"The condition is false"<<--

	if (3>7) {
		echo "The condition is true"; 
	}
	else {
		echo "The condition is false"; 
	}
?>

#3

A post was split to a new topic: 4/4 all together now