Content deleted Content added
→Use in school and higher education: Added reference |
Added comparison with Delphi (new features) |
||
Line 30:
}}
'''PascalABC.NET''' is a [[High-level programming language|high-level]] [[General-purpose programming language|general-purpose]] [[programming language]] supporting multiple paradigms.
PascalABC.NET is implemented for the [[.NET Framework]] platform, so that it is compatible with all .NET libraries and utilizes all the
==
===
'''•''' <code>loop</code> operator<syntaxhighlight lang="delphi">
loop 10 do
Write('*');
</syntaxhighlight>'''•''' <code>for</code> loop with a step<syntaxhighlight lang="delphi">
for var i:=1 to 20 step 2 do
Print(i);
</syntaxhighlight>'''•''' <code>foreach</code> loop with an index<syntaxhighlight lang="delphi">
foreach var c in Arr('a'..'z') index i do
if i mod 2 = 0 then
Print(c);
</syntaxhighlight>'''•''' <code>a..b</code> ranges<syntaxhighlight lang="delphi">
(1..10).Printlines
</syntaxhighlight>'''•''' short function definition syntax<syntaxhighlight lang="delphi">
function Sum(a,b: real) := a + b;
</syntaxhighlight>'''•''' method implementation can be placed inside a class definition<syntaxhighlight lang="delphi">
type Point = class
x,y: real;
procedure Output;
begin
Print(x,y);
end;
end;
</syntaxhighlight>'''•''' <code>sequence of T</code> type as an abstraction of arrays, lists and sets<syntaxhighlight lang="delphi">
var seq: sequence of integer := Arr(1..10);
seq.Println;
seq := Lst(11..100); seq.Println;
seq := HSet(1..20); seq.Println;
</syntaxhighlight>'''•''' lambda functions<syntaxhighlight lang="delphi">
var a := ArrGen(10,i -> i*i);
</syntaxhighlight>'''•''' auto classes - classes with an automatically generated constructor<syntaxhighlight lang="delphi">
type Point = auto class
x,y: real;
end;
var p := new Point(2,5);
</syntaxhighlight>'''•''' one-dimentional and multi-dimentional array slices<syntaxhighlight lang="delphi">
var m: array [,] of integer := MatrGen(3,4, (i,j) -> i+j+1);
Println(m); // [[1,2,3,4],[2,3,4,5],[3,4,5,6]]
Println(m[:2,1:3]); // [[2,3],[3,4]]
</syntaxhighlight>
=== Functional style features ===
Line 200 ⟶ 210:
</syntaxhighlight>
==
In 2017<ref>{{Cite web|lang=en|url=https://pvs-studio.com/en/blog/posts/csharp/0492/|title=Analysis of PascalABC.NET using SonarQube plugins: SonarC# and PVS-Studio|website=PVS-Studio|date=2017-03-29}}</ref> and 2022<ref>{{Cite web|lang=en|url=https://medium.com/pvs-studio/re-checking-pascalabc-net-f8bfc94aba3c|title=Re-checking PascalABC.NET|website=Medium|date=2022-02-11}}</ref>, independent audit of [https://github.com/pascalabcnet/pascalabcnet PascalABC.NET public repository] was conducted. Based on the results of the static check, potentially dangerous code fragments were listed that require additional analysis by developers. It was also noted that the overall quality of the code could be improved. To do this, code duplication and redundant checks should be eliminated, and refactoring should be performed more carefully.
|