Quote:
Originally Posted by Myk267
If the syntax is different, and the semantics are different, then what's similar at all?
|
ohh gezz semantics vs syntax. the methodology or ideology. Whatever term you want to use to make it sound right in your head. every programming language is basically the same it all works off of true and has if, case, loops, Boolean and is used as a means to tell the CPU what to do. it is like speaking a different language to get someone to do something for you. it sounds different but it still is saying the same thing. The idea behind how to get it done is the same regardless of what language one uses. that is what makes it similar.
'copy file to path' can be written many different ways depending on what language one uses, the idea or need to do something is the same. take 4 different programming languages and write them out to do that operation.
You'll see that the similar is the coping of a file to a different place how one writes it is different. but still has a "if statement" I am sure for error checking and has to return true before it is executed. regardless if it is
'if (not true) then' or 'if (false) then' it still resolves to a true statement before it will be executed regardless of what programing language is used or how it has to be written by the specifications that the who ever designed the programming language says it has to be written for it to work.
rearguards if one has to write the 'then' or not that is up to the programming language designer. It all preforms the same functions. Even that is redefined by what language one is using.
functions return a value.
procedures do not.
Even though they both preform a function but not all Programming Languages require this division. C and C++ can have functions that do not return a value. Pascal calls them procedures.
If you cannot see the similarities within different programming languages that just boggles my mind. regardless it all gets broken down to zeros and ones in the end.
if they did not add a feature within the headers or api or whatever they want to call it that is used to be able to use the functions within the language then yeah not every language is going to accept
Code:
True == ""
True = NULL
True = '\0'
True == '0'
Javascript BTW is not even considered a programming Language.
Quote:
Search Results
JavaScript was not developed at Sun Microsystems, the home of Java. JavaScript was developed at Netscape. It was originally called LiveScript, but that name wasn't confusing enough. The -Script suffix suggests that it is not a real programming language, that a scripting language is less than a programming language.
|
Code:
if (true) {
do_something();
}
if (false) {
do_something_else();
}
I see no reason any programming language would throw an error if not using a else to do that. all that is is two different if statement checking for a true condition of something or even the same thing.
better written as such or should i say depending on the programming language it has to be written like this, but it still does the same thing.
Code:
if (true) {
do something ()<-- that indicates a function call
}
#all the brackets do is encase it. Not all programming languages require this for one line of execution.
if (! true) {
then do something else
}
in every programming language it does the same. It checks for a true condition.
all the adding of the word else does is eliminate the need to write another complete if statement to check for that other true condition. The 'else' is then implied and not explicit is all.
Then someone came up with an idea to save writing and time to execute the code by designing the language to accept the word 'else' instead of having to write an entire different if statement to check for the other side of the condition which are BOOLEAN yes or no conditions. Which takes more time to run it through again to recheck it.
Code:
if (true) {
do something
else
do something else if false
}
it is either a yes or no condition, both are if statements, only had to eliminate the explicitness of the second if statement to cut down compile and execution time. one has to be in a true state. It cannot be both at the same time. if it is something else then something is wrong so throw an error.
Where some languages it has to be written like this.
Code:
if (true)
{
do something
}
else
{
do something else if not true
}
that if statement is still there. only this time the if statement is now implied, and not the else.
if it is a no or not true then it is still a true condition that is being return.
A true in one or the other condition has to be achieved for the one or other to be executed. That is a similarity.
It all works the same regardless of how it has to be written.
so excuse me for not adding the word semantics to be more clear so as not to confuse another that cannot see what is similar between two different programming languages.
it it the programming itself the language one uses is just the means to get the something done.
break it down, the condition has to be true before it does something or it throws an error. regardless of what programing language one uses or scripting language (too) for that matter.