Autoincrement şi autodecrement cu şiruri

92

Linie program (tst15.pl)

Rezultat la consola text

$a="aBC";$a++;

print('$a++ = ',$a,"\n");

$a++ = aBD

$a="aBC";++$a;

print('++$a = ',$a,"\n");

++$a = aBD

$a="aBC";$res=$a++;

print('$a = ',$a,' $res=$a++ : ',$res,"\n");

$a = aBD $res=$a++ : aBC

$a="aBC";$res=++$a;

print('$a = ',$a,' $res=++$a : ',$res,"\n\n");

$a = aBD $res=++$a : aBD

 

 

$a="aBC";$a--; print('$a-- = ',$a,"\n");

$a-- = -1

$a="aBC";--$a; print('--$a = ',$a,"\n");

--$a = -1

$a="aBC";$res=$a--; print('$a = ',$a,' $res=$a-- : ',$res,"\n");

$a = -1 $res=$a-- : aBC

$a="aBC";$res=--$a; print('$a = ',$a,' $res=--$a : ',$res,"\n\n");

$a = -1 $res=--$a : -1

 

 

$a="AGZZZ";;$a++;print('$a++ = ',$a,"\n");

$a++ = AHAAA

$a="AGZZZ";;++$a;print('++$a = ',$a,"\n");

++$a = AHAAA

$a="AGZZZ";;$res=$a++; print('$a = ',$a,' $res=$a++ : ',$res,"\n");

$a = AHAAA $res=$a++ : AGZZZ

$a="AGZZZ";;$res=++$a; print('$a = ',$a,' $res=++$a : ',$res,"\n\n");

$a = AHAAA $res=++$a : AHAAA

Cornel Mironel Niculae, 2003-2004

13-Nov-2009