Questions tagged [subroutine]

A subroutine (e.g. procedure or subprogram) is a portion of code within a larger program, which performs a specific task and can be relatively independent of the remaining code. The syntax of many programming languages includes support for creating self contained subroutines, and for calling and returning from them. They are in many ways similar to functions, but usually have side-effects outside of the simple "return value" that functions return.

1255 questions
-2
votes
3 answers

Is there any way to run three python files sequentially as the output of each file depends on the other

I have three python files file1.py, file2.py, file3.py. Each file will generate a .csv file and will give it to the other file sequentially. To elaborate file1.py will generate file1.csv and this .csv file will be the input of file2.py and so on. …
Manu9
  • 31
  • 1
  • 7
-3
votes
1 answer

Perl subroutine not working in loop

I tried writing a simple code to find whether a number can be expressed as the sum of primes or not, in Perl. The sample code is as shown: sub funcIsPrime { my $num = $_[0]; my $isPrime = 1; for($i= 2; $i <= $num/2; $i++){ …
Rajni Sah
  • 1
  • 1
-3
votes
2 answers

How do I output values from these two subroutines?

I'm trying to call on the XCoordinate and YCoordinate and the grid to display it in the main, how would I go about it? public static void DisplayBoard(char[,] Board) { string[,] grid = new string[3, 3] {{" "," "," "}, …
Pavvel
  • 23
  • 2
  • 7
-4
votes
1 answer

How do I access the parameters and use them in the main program?

using System; namespace MyApplication { public class Program { static void CalculateCost(int length, int width, int area, int underly, int grippers, int grip, int fee, int carpet, int roomcarp, int total) { …
-4
votes
2 answers

How to call a subroutine in perl?

I try to call a Subroutine in Perl but I get this error "Malformed prototype for main". I have a Subroutine Compare and I have to pass to it two integer. #!/usr/bin/perl @ListA=(1,2,3); @ListB=(2,3,4); @ListResult; #AND sub Compare($p1,$p2){ …
hhl
  • 97
  • 1
  • 1
  • 9
-4
votes
5 answers

how to print output of a subroutine in C?

I am using a very simple code for subroutine but it is not printing right values. Please help me in this. My code is: #include #include main(){ int i, a, b=0.0, c=0.0; void sum(int a , int b); for ( i = 0; i < 2; i++ ) { …
user3132983
  • 65
  • 1
  • 5
-5
votes
1 answer

Run-Time Error '1004' in VBA Subroutine

There seems to be something wrong with one of my Excel Objects. Take a look at the below snippet. I created the subroutine Run_all(), and when I step through, it'll go up to the Function row_count() and start executing, however, when it gets to the…
T. Price
  • 1
  • 1
  • 2
-5
votes
3 answers

understanding subroutines in perl

sub bat { my ($abc) = @_; my @gCol ; { my $rec = {}; $rec->{name} = "BATID"; $rec->{type} = "VARCHAR2"; $rec->{length} = "14"; $rec->{scale} = "0"; $rec->{label} = "Id"; …
Kamlesh Sam
  • 13
  • 1
  • 3
-7
votes
5 answers

Logic error involving area of circle

In python, don't know why, it some kind of logic error, as in it's not the right number, where i'm supposed to create a algorithm which calculate area of a circle from the radius. My python code
yomum 21
  • 1
  • 1
  • 4
-7
votes
3 answers

Why am I getting warnings about an uninitialized value in this Perl program?

I get these errors Use of uninitialized value $vm_name in pattern match (m//) at testscript.pl line 164, line 1. Use of uninitialized value $vm_name in concatenation (.) or string at testscript.pl line 173, line 1. Can anyone help?…
3c75
  • 17
  • 5
1 2 3
83
84