When starting to develop new systems, sometimes it is good to work through it before you actually start writing it. Or maybe you run into a problem while writing a code and it's very hard to sift through it. So, the ideal solution would be to pseudo code it, or in other words, simplify writing statements in the margin.
So, comparing codes, here is what a simple script would look like that ouputs text in PHP:
<?php print "Hello World."; ?>
Select what you want to copy and in doing so you will keep the formatting when pasting it. |
It's similar in pseudo code, just without all the detailed stuff.
output Hello World
Select what you want to copy and in doing so you will keep the formatting when pasting it. |
What would putting in conditions? Well my friend, here is your answer:
PHP:
<?php $a = (String) "hello"; $b = (String) "hellos"; if($a === $b) print "Yep."; else print "Nope."; ?>
Select what you want to copy and in doing so you will keep the formatting when pasting it. |
Pseudo Code:
A = hello B = hellos IF A IS B THEN OUTPUT Yep. ELSE OUTPUT Nope.
Select what you want to copy and in doing so you will keep the formatting when pasting it. |
If you are firmiliar with Visual Basic, you can see the similarities between the two languages. Next I will show you a bit more advance code in Pseudo code.
// Dummy code X = 1 Y = 10 daytime = TRUE OUTPUT Is it daytime? CASE daytime OF TRUE : output "Yes" FALSE : output "No" END CASE FOR XY = 1 TO 10 output "Count" + XY IF X > 2 THEN output "X is good to go!" IF Y < 20 output "Y is good to go!" END FOR
Select what you want to copy and in doing so you will keep the formatting when pasting it. |
So, this is a basic example that does just about nothing but output text.
Keep in mind, you can do quotes around output strings if you want. It really helps when you get into longer code to do this. Pseudo Code is different in a lot of different ways, and every person puts their own spin on it, since it is not an "official language". It does have guidelines though, that many sites have outline, like this one:
http://users.csc.calpoly.edu/~jdalbey/SWE/pdl_std.html
Psuedo code does a lot for you when you are working on big programming projects and can be a life saver when trying to solve problems. This helps when you don't want to write actual code, just work through it faster without the necessary work.