Tag Archives: language

Array and PHP

knowledge representation

$ 4.1.5 20 84---> cat phparray.php
<?php
$arr[] = "PHP";
$arr[] = "C";
$arr[] = "C++";
$arr[] = "Java";
$arr[] = "Perl";
$arr[] = "Python";
$arr[] = "Ruby";

foreach($arr as $lang)
{
if(!strcmp($lang, "PHP")){
print "Welcome PHP";
echo "\n";
}else{
print $lang ;
echo "\n";
}
}
?>
$ 4.1.5 21 85---> php phparray.php
Welcome PHP
C
C++
Java
Perl
Python
Ruby
$ 4.1.5 22 86--->

working with scala examples 1

knowledge representation

$ 4.2.29 15 515---> scala
Welcome to Scala version 2.9.2 (OpenJDK 64-Bit Server VM, Java 1.6.0_24).
Type in expressions to have them evaluated.
Type :help for more information.

scala> 4*2-7
res0: Int = 1

scala> res0+1
res1: Int = 2

scala> 2*0.4
res2: Double = 0.8

scala> "hello"
res3: java.lang.String = hello

scala> "hello"+res3
res4: java.lang.String = hellohello

scala> "hello"+res2
res5: java.lang.String = hello0.8

scala> "hello res2"
res6: java.lang.String = hello res2

scala>