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.
Questions tagged [subroutine]
1255 questions
-1
votes
1 answer
Subroutine always returns the -1 value , how do I rearrange to make it function?
/
* Finds the first vowel in a word and returns its location
*
*/
public static int findFirstVowel (String word) {
int consonant = 0;
for(int count = 0; count < word.length(); count++){
word.toUpperCase();
char…

Ella Withington
- 13
- 1
-1
votes
1 answer
Fortran Subroutine not returning value
i run into a strange problem.
I am using the locate subroutine from the Fortran-Recipe book.
The goal is to find a random number in a CDF-table and return the index of the arrax, such that i can look in another table for the value this would…

busssard
- 158
- 1
- 1
- 11
-1
votes
1 answer
Excel subroutine to create all possible combinations from a data set excluding duplicates
Does anyone know a routine on how to get a data set composed by 7 columns into all possible combinations?
the combination is composed by 7 numbers like this--> 1|3|8|10|35|40|50
The routine needs to look into the first table and make a list of all…

Dario
- 23
- 4
-1
votes
3 answers
Unable to call second subroutine "func2"
Coding
print "fruit list\n";
print "1.\tApple\n";
print "2.\tOrange\n";
print "3.\tPic\n";
print "3.\tBanana\n";
print "Based on fruit list above, please key in your favorite fruit name.\n";
%fruit_list = (
1 => 'Apple',
2 => 'Orange',
…

user6201481
- 39
- 6
-1
votes
1 answer
Calling Subroutines in Kotlin
I can't seem to find any information on subroutines and how to call them in Kotlin. I'm practicing by creating a system which takes input from a user and displays the content prompting the user to say yes if their information is correct, or no if it…

Carl Summers
- 3
- 1
- 1
-1
votes
1 answer
LC3 Subroutine - Custom Trap Routine
I am working on a question which the goal is to create a subroutine that imitates the trap (PUTS) and it will write a string to console, this strings addres can be assumed to be in r0
this is what I have so far, it works for the first character 's'…

rahulchawla
- 170
- 1
- 3
- 20
-1
votes
1 answer
Architectural Analysis: when all registers are used by by the subroutine, what must the machine do before jumping to the new subroutine?
In OO programming we organize small chunks of frequently run code into methods. This reduces the total amount of code compared to copy/past (among other advantages). In assembly and machine languages these reusable chunks are called…

Brendon Png
- 1
- 1
-1
votes
1 answer
Perl subroutines with exact signature / exact number of parameters
I have seen usage of $ in subroutine definition somewhere. To learn more about it, I created various cases with a simple subroutine, and came to know that it's used for defining subroutines with exact signatures.
Can anyone please confirm:
Whether…

Kamal Nayan
- 1,890
- 21
- 34
-1
votes
1 answer
Creating new variables in Abaqus
Here is what I like to do in Abaqus (if possible):
As a minimum working example, let's say I have an elastic specimen that I am applying a load on. When I look at the results I can see S11, S22, S33, etc...
What I would like to see are things like…

Mark Kavanagh
- 7
- 5
-1
votes
3 answers
What is wrong with this Perl subroutine?
I'm trying to implement a subroutine that calculates the d-neighbors of an input string. This is apart of an implementation of planted motif search, but my question is much more general. Here is the code:
#subroutine for generating d-neighbors
sub…

Kyle Weise
- 869
- 1
- 8
- 29
-1
votes
1 answer
Issues with subroutine Perl
I'm trying to execute a Perl program, but the window only closes up. But if I select a part of the window, it stays open, and I press Enter and says
Undefined subroutine &genNumeros::crearNumero called at .... at line 17
genNumeros.pm
package…

Jairo
- 29
- 1
- 6
-1
votes
1 answer
perl, populating a hash from a subroutine call on file input, array input, or no input
I made the class as follows:
package Tool;
sub new {
my ( $class, %args ) = @ARG;
my $self = bless {
#hash reference
_ToolParameters => { }
}, $class;
return $self;
}
I then want to create an instance of this class:
my $Object…

Plexus
- 67
- 1
- 8
-1
votes
1 answer
Calling multiple subroutines repetitively or simply calling an extensive subroutine once
In my CFD Solver, several extensive computations must be applied throughout the domain on each node depending on indices i, j, k, and l. The domain is 3-D and have a resolution of IMAX + 1 by JMAX + 1 by KMAX + 1.
My problem is about repetitive…

Shaqpad
- 107
- 2
- 13
-1
votes
2 answers
Perl subroutines
Here I fixed most of my mistakes and thank you all, any other advice please with my hash at this point and how can I clear each word and puts the word and its frequency in a hash, excluding the empty words.. I think my code make since now.

Yasser Ḿ
- 19
- 2
-1
votes
1 answer
Second instance of batch loop does not run
I am trying to create a DOS batch script on my Windows 7 machine. I want to execute file 123456.bat, which contains the following command and parameters:
call **startSelenium.bat** 55 someSuiteName suite-someSuite.html development 1 1 10 10
That…

lalbright
- 3
- 2