​​​​​​SCRIPTING LANGUAGES:​


​​​​​​​​​​​We all have heard this word (actually two words) in reference to many languages like python, perl etc. But what ​
​does it actually mean?​
​​
​Actually, their has never been any particular definition to discriminate a language as a scripting language, but the ​
​general common features are (I will be using python (scripting language) and C++ (non-scripting language) as an ​
​example):​
​​
​​
​​
​​

    ​​

  • ​​​​​These languages are generally purposed for system administration, web programming, text processing etc.​​​​​​​​​
    ​​
    ​​
    ​​

​​​​​​
​​
​​
​​

    ​​

  • ​​​​​These languages are very casual in respect to the differentiating of variables according to their type.​​​​​​​​​
    ​​
    ​​
    ​​

​​​​​So their is little or no distinction between integer or floating point or string variables.​
​     ​
​  ​
​​
​​​​​​​   In C++:​
​​
​​
​​
​​​​​            ​
​              int a,b,c;​
​             char d,e[50]; //e represents a string​
​     ​
​     ​
​​
​​​​​​​In Python:​
​​
​​
​​
​​​​​             ​
​             a=12​
​             b=’Hello’​
​             c=”Hello”​
​​
​​
​​
​​

    ​​

  • ​​​​​Arrays can thus mix elements of different types such as integers, strings etc.​​​​​​​​​
    ​​
    ​​
    ​​

​​​​​​
​ ​
​​
​​​​​​​    In C++:​
​​
​​
​​
​​​​​              ​
​              NOT POSSIBLE​
​     ​
​   ​
​​
​​​​​​​  In Python:​
​​
​​
​​
​​
​​​​​             a=[‘Jon’,23,’M’]​
​​
​​
​​
​​

    ​​

  • ​​​​​Their functions can also return non-scalar elements like arrays. Moreover, these non-scalars can also​​​​​​​​​
    ​​
    ​​
    ​​

​​​​​be used as loop indexes etc.​
​​
​    ​
​​
​​​​​​​ In python:​
​​
​​
​​
​​
​​​​​             a=[‘Mon’,’Tue’,’Wed’,’Thu’,’Fri’] #initialisation of the tuple​
​             for i in a:                                   #loop runs till i reaches end of the tuple​
​                     print(i)                              #print value of ‘i’​
​​
​     This program prints all the working weekdays…​
​​
​​
​​
​​

    ​​

  • ​​​​​Lots of high-level intrinsic operations eg. string concatenation and stack push/pop re a lot easier.​​​​​​​​​
    ​​
    ​​
    ​​

​​​​​​
​    ​
​​
​​​​​​​ In C++: ​​​​​​​​​​concatenation of strings:​
​     ​
​     #include<iostream>​
​     using namespace std;​
​     int main(){​
​         char a[]=”Hello”,b[]=”World”,c[12];​
​         int i;​
​         for(i=0;a[i]!=”;i++){​
​                                 c[i]=a[i];​
​                                 }​
​         for(int j=0;b[j]!=”;i++,j++){​
​                                 c[i]=b[j];​
​                                 }​
​         c[i]=”;​
​         for(i=0;c[i]!=”;++i){​
​                 cout<<c[i];​
​                 }​
​         return 0;​
​         }​
​​
​    ​
​​
​​​​​​​ In python:​​​​​​​​​​ concatenation of strings:​
​             ​
​             a=’Hello’​
​             b=’World’​
​             c=a+b​
​             print(c)​
​​
​The programs are interpreted rather than being compiled. (The basic difference between interpreting and ​
​compilation is that in interpretation, the code is checked line by line and the processing stops whenever an error is ​
​encountered where as in compilation, the whole code is checked in one whole go and all the errors are reported at ​
​the end. The topic of compilation and interpretation will be picked in a later time.)​
​​
​​
​​​

Advertisements
Explore posts in the same categories: Python

Tags: , ,

You can comment below, or link to this permanent URL from your own site.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


%d bloggers like this: