Home | Programming | Php
It's time to start introducing some more complex programming logic today! Conditional statements are still fairly simple to understand but allow for much more complex capabilities than I have demonstrated thus far. For example, while creating variables is useful, we quickly find ourselves limited in the types of applications we can make without further logic. Conditional statements allow us to include some very basic artificial intelligence into our programs by allowing the software to make certain decisions on its own based on the values of variables. Please keep in mind that while I am demonstrating this in the context of PHP, IF/ELSE statements are a fundamental component of most programming languages. So how does the computer make a decision? Basically, you provide a statement and then the system will verify whether that statement is true of false. Depending on the result, a different path of code will be executed. Here is an example:
<?php if ($newMember) { $sendWelcomeEmail = True; } else { $sendWelcomeEmail = False; print "Already a member!"; } ?>
Article Source: http://www.writerdatabase.com
www.webdevnotes.com/ifelse-programming-logic/
Please Rate this Article
5 out of 54 out of 53 out of 52 out of 51 out of 5
Not yet Rated