Monday, December 21, 2015

Writing source code



Programming language Source Code is written in plain text, you can open a simple text editor that comes with the operating system on the PC such as Notepad or TextEdit on the Mac, and work well for writing any programming language.

There's nothing magical about source code itself. It's just text, and that's plain text, not rich text, so here for example is a text editor with some JavaScript in it
Javascript
alert("Hello, world");
and here is one with some Perl
Perl
say "Hello, world!";
and here is one with some Ruby
Ruby
puts'Hello, world!'
and here is one with some Groovy.
C
printf( "Hello World. \n");
and here is one with some Groovy.
groovoy
say "Hello, world";
and yes, Groovy is a language.
Now right now don't worry at all about trying to memorize any of these, which come later. Just observe them, Hello, world is the classic example of this simplest program imaginable in any language.
So let me tell you a few more
ALGOL 68
print("Hello World")
So this is a one statement program written in a language called ALGOL 68 and by 68 here I mean 1968 which is when this language was released.

ALGOL 68 is not a language you're ever going to need to know, but on the other hand you might want to know Python, so this is a one statement program written in Python 3 released in December 2008.
Python
Print(“Hello World”)
This is a one statement program written in a language called Lua.
Lua
Print(“Hello World”)
Yes, this particular statement is the same in all of them and in a few more languages besides. You see many languages share a common history and they are often more alike than they are different.
ALGOL 68/Python 3/ Lua
print(“Hello World”)
Now just because this statement is the same in these languages does not mean these languages are identical, far from it, but there are often significant similarities between languages.

Now, some languages do need a little more than one single statement to be considered a full program. Many languages like to be given explicit starting and ending points. An older version of ALGOL, ALGOL 60, was written in all caps and actually required the words BEGIN an END to mark out your program.

Languages like C and other languages based on C like C#, C++ and Java, they require what can first seem like intimidating amounts of curly braces and weird esoteric keywords just to get something simple to happen like the words, “Hello, world!”


Now you might think, okay so am I supposed to remember all of this to write just the simplest program? Well, no, not really.

0 comments:

Post a Comment

Facebook Fan Page

Popular Posts

Powered by Blogger.