Rosetta Stone for a Few Languages

Item JavaScriptC#JavaPerl   C++   ColdFusionPython
Pause none, but see window.setTimeout() System.Threading.Thread.Sleep(int milliseconds) Thread.sleep(int milliseconds) sleep(int seconds)     time.sleep( time in seconds )
Comments /*   */
//
/*   */
// or /// for docs
/*   */
//
# /*   */
//
<!---   ---> # comment multi-line hack = three quotes ''' comment ''' or """ comment """
Printing document.write("mytext\n"); Console.Out.WriteLine("mytext"); System.out.println("mytext"); print "myvar=".$myvar; cout << "this is a note.";   print "mytext"
if
if (i == 0)
   { ... }
else
   { ... }
if (i == 0)
   { ... }
else if (i==2)
   { ... }
else
   { ... }
if (i == 0)
   { ... }
else if (i==2)
   { ... }
else
   { ... }
$i=0;
if ( $i eq 0 )
     { ... }
elsif ($i eq 2)
     { ... }
else 
     { ... }
 
<CFIF #DINNER# CONTAINS "MEAT">
   <CFSET #DinnerType# = "Carnivore">
<CFELSEIF #DINNER# CONTAINS "Vegtables">
   <CFSET #DinnerType# = "Veggies">
<CFELSE>
   <CFSET #DinnerType# = "Other">
</CFIF>
if x < 0:
      x = 0
      print 'Zero'
   elif x == 0:
      print 'Zero'
   elif x == 1:
      print 'One'
   else:
      print 'lots'

looping
for(var i=0;i<count;i++)
   {...}
for(i=0;i<count;i++)
   {...}
for(i=0;i<count;i++)
   {...}
<CFLOOP INDEX="LoopCount" FROM="1" TO="5">
   Index is 
   <CFOUTPUT>#LoopCount#</CFOUTPUT>.<br />
</CFLOOP>
for i in range(count):
...
exit  
Environment.Exit(1);
System.exit(int);
die "sorry.";
exit 0;
exit(int); <CFABORT> exit = sys.exit(-1)
Size of Array ArrayName.length ArrayName.Length ArrayName.length scalar(@ArrayName)     ArrayLength.length
Random Number Math.floor(Math.random()*101); Random random = new Random();
random.Next(0, 100);
         
Go to Home page. Kindly report errors, typos, or misspellings here.