The switch Statement - SPVM - The Project for Python/NumPy Porting to Perl
Yuki Kimoto
Posted on November 13, 2022
The switch
statement in SPVM language is a statement for conditional branch.
# switch statement
my $code = 2;
my $flag = 1;
switch ($code) {
case 1: {
print "1\n";
}
case 2: {
print "2\n";
}
case 3: {
if ($flag) {
break;
}
print "3\n";
}
case 4:
case 5:
{
print "4 or 5\n";
}
default: {
print "Other\n";
}
}
# switch statement using enumeration
class Foo {
enum {
ID1,
ID2,
ID3,
}
static method main : int () {
my $value = 1;
switch ($value) {
case Foo->ID1: {
print "1\n";
}
case Foo->ID2: {
print "2\n";
}
case Foo->ID3: {
if ($flag) {
break;
}
print "3\n";
}
default: {
print "Other\n";
}
}
}
}
How to install SPVM::Numpy
cpanm SPVM::Numpy
# Developper
cpanm SPVM;
git clone https://github.com/yuki-kimoto/SPVM-Numpy.git
See also Installing SPVM::Numpy
What Is SPVM?
SPVM is a static typed language that can be used from Perl. SPVM is the essential part of the Python/numpy porting to Perl. If you haven't heard of Perl's SPVM. Please see also SPVM Language Specification.
How potential dose SPVM have?
Growth is expected in the fields of Bio Tech, AI/ML, Apple/iPhone/iPad Apps, Google/Android Apps, IoT Device, Connected Car, Smart Device, Smart Home, etc.
This is because SPVM can produce an executable file that supports cross platforms and make easy to calculate arrays and bind C/C++ and Nvidia/GPU/cuda.
SPVM Documents
SPVM Modules
This project really needs contributors, sponsors, investors.
This project really needs contributors. I am looking for contributors, sponsors, investors.
Posted on November 13, 2022
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.