HI every one with an exciting new topic I am your writer PJ is here.
I was wonder when I was in my studies why we learn these boring variables, arrays, loops etc., I know most of the students still suffer with these kind of confusions.
Another most popular sentence I always heard about codding was “programmers have strong logics” you must have logical to do programming, But what does ‘logic’ mean in programming?. is that really maters? yes logics are important but the question is how??
Lets explain this here how I understand what actually the logic is:
Simply start from a variable which teachers taught us how variable can be declare, initialize and use. isn’t it Kind of boring and confusion to memorize all these concepts but where the hell is logic behind this.
What is the logic behind using variable where they are actually used?
see here: simply variable is a name with which we call our value (value means some thing we need later, or need the thing again some where when we program or design software) which we store in it.
here is some examples to show what variables are?
see confused why we give name to these there is no need to save 30 in the PJ.
but what about this variable
PJ = c + d
The above is the plus formula if I need this formula where in my file I just call PJ which makes sense.
another example
In the above program I need to print the PJ variable outside the loop. I didn’t need to re sum the variable works as it has the sum formula. so the calculation never need to compile again.
So the work and computation both precise. lets understand another logic to use variables
lets precise more logics
$var_1 = “<html><h1>This can be reuse again and again by just calling var_1 which is my name</h1> <html>”
$var_2 = “<script>alert(‘call me’)</script>”
echo $var_1
echo $var_2
echo $var_1
echo $var_2
In the above example I don’t write a whole lengthy code again and again instead I will just call a name of variable and it will print all.
Another more exciting logic
<?php
if ($_SERVER[“REQUEST_METHOD”] == “POST”)
{ $submit = $_POST[‘submit_language’];
$txt = htmlspecialchars($_POST[‘language’]);
if(isset($submit)) {
echo “I love $txt!<br>”;
echo “I hate $txt<br>”;
echo “I am a new programmer who wants to test my language, which is $txt<br>”;
} }
?>
<!DOCTYPE html>
<html>
<body>
<form action=”” method=”post”>
Type your favorite language:
<input type=”text” name=”language”/>
<input type=”submit” name=”submit_language”/>
</form>
</body>
</html>
Conclusion: Embracing the Logic of Programming
In this blog post, we’ve delved into the foundational concepts of programming, from variables to logic structures like loops and conditionals. While these concepts may seem daunting at first, understanding their underlying logic is the key to unlocking the potential of programming.
We’ve seen how variables serve as placeholders for data, allowing us to reuse and manipulate values efficiently. Through examples, we’ve explored how variables streamline complex computations and make code more concise and readable.
Additionally, we’ve touched on the importance of logic in programming, emphasizing that it’s not just about following rules but also about problem-solving and critical thinking. By grasping the logic behind programming constructs, we empower ourselves to tackle real-world challenges and create innovative solutions.
As you continue your journey in programming, remember to embrace the logic at its core. Approach each concept with curiosity and persistence, and don’t be afraid to experiment and learn from your mistakes. With practice and dedication, you’ll soon discover the endless possibilities that programming has to offer.
So, whether you’re a seasoned developer or just starting out, let’s embrace the logic of programming and embark on a journey of creativity, problem-solving, and discovery. Happy coding!
Wait for another blog post to understand variables logic in more deep and precise way and with real time examples. Also we will delve into more logics of arrays, loops and much more.