Rosetta Stone of Computer Languages

From PharmWiki
Revision as of 19:38, 26 January 2022 by Admin (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
Rosetta Stone of Computer Languages
Command Python 2.X Python 3.X C++ FORTRAN Igor Pro
Comments # Single Line

''' Block Comments'''

""" Block Comments """

# Single Line

''' Block Comment '''

""" Block Comment """

// Single Line

/* Block Comments */

! Single Line // Single Line
Print Statement[1] def Hello():

print "Hello, World!"

def Hello():

print("Hello, World!")

#include <iostream>

int main()

{

std::cout << "Hello, World!\n";
return 0;

}

program Hello

print *, "Hello, World!"

end program Hello

Function Hello()
print "Hello, World!"

End

If-then statement var1  = 1

var2  = 2


if var2 > var1:

print "var2 is greater than var1"

elif var1 > var2:

print "var1 is greater than var2"

else:

print "var1 = var2"
var1  = 1

var2  = 2


if var2 > var1:

print("var2 is greater than var1")

elif var1 > var2:

print("var1 is greater than var2")

else:

print("var1 = var2")
#include <iostream>[2]


using namespace std;


int main () {

// local variable declaration:
int var1=1;
// check the boolean condition
if( var1 < 20 ) {
// if condition is true then print the following
cout << "var1 is less than 20;"<< endl;
}
cout << "value of a is : " << var2 << endl;


return 0;

}
integer :: var1 = 1[3]


if (var1 < 20 ) then

print*, "a is less than 20"

end if

Variable var1=1

Variable var2=2


if (var2 > var1)

print "var2 is greater than var1"

elseif(var1>var2)

print "var1 is greater than var2"

else

print "var1=var2"

endif

References and Notes