subroutine Questions

2

Solved

I am trying to write a function that can take all of its arguments and print them as a string exactly as they were entered. For example using the following function: test('arg1' => $arg1, 'arg...
Theine asked 1/4, 2016 at 16:46

1

I am not understanding the importance of CONTAINS statement in fortran 90 For example PROGRAM BLABLA IMPLICIT NONE INTEGER :: i,j,k i = 1; j = 1;k =1 PRINT *, i,j,k CALL ABC(i,j,k) PRINT *,...
Gimcrackery asked 4/3, 2016 at 23:39

3

I have been trying examples for hours but I can't seem to grasp how to do what I want to do. I want to return a hash from a subroutine, and I figured a reference was the best option. Here's where ...
Lettuce asked 14/5, 2014 at 8:15

3

Solved

I'm writing some code where I am using a subroutine as both an lvalue and an rvalue to read and write database values. The problem is, I want it to react differently based on whether it is being us...
Olav asked 3/2, 2016 at 17:40

2

Solved

In Perl, I've always liked the key-value pair style of argument passing, fruit( apples => red ); I do this a lot: sub fruit { my %args = @_; $args{apples} } Purely for compactness and hav...
Aleurone asked 24/1, 2016 at 0:41

2

Solved

When I compile the program below, I have an error and a warning in the call Coor_Trans command line as Warning: Line truncated Error: Syntax error in argument list I compile the program several t...
Tuttle asked 10/12, 2015 at 5:46

1

Solved

From what I read, the branch with link is used to perform subroutine call and the registered link is copied back to PC.
Wenda asked 11/10, 2015 at 19:13

1

Solved

I got told to try and use 'jmp rather than 'call', but 'jmp' is not liking me .. when I jump it doesn't return (so it never exits and not happy days ), but calling returns and exits as normal. I ...
Conjuncture asked 26/9, 2015 at 2:47

6

In a DOS Batch File subroutine, how can I turn off echo within the subroutine, but before returning, put it back to what it was before (either on or off)? For example, if there was a command calle...
Tancred asked 6/3, 2012 at 22:10

1

Solved

I can define a subroutine and take a reference to it like this sub F { q(F here) } $f = \&F; print &$f # prints “F here” But how can I do the same with, e.g., sin? $f = \&sin; print...
Bedad asked 22/9, 2015 at 9:2

7

EDIT: I'm glad no one has spent any time pointing out that the actual text in line 6 and 7 has a different number than the input for their respective function calls. Eventually I'll be doing it for...
Blackstock asked 15/9, 2015 at 21:3

1

I am learning Java and there's something bothering me and the textbook doesn't explain it. I understand that you use modifiers to declare methods inside classes and all. But I suddenly got to...
Biomass asked 8/9, 2015 at 0:45

2

Solved

I am writing a program in Fortran 95 (to be compiled with with gfortran) containing a subroutine that performs a certain computation. As suggested in "Fortran 95/2003 for Scientists & Engineers...
Stivers asked 7/8, 2015 at 9:15

1

Solved

I have a subroutine that normally takes 1 second to run. Sometimes, it can run infinitely. I want to move on in the code if the subroutine is taking too long (> 10 seconds) and ignore that run of t...
Merriment asked 28/7, 2015 at 15:38

2

Solved

When using the CALL command to call a label in a batch script, and you end the sub-routine with GOTO:eof, what happens from there? Does it return back to where the sub-routine's CALL is located? Or...
Diseuse asked 18/7, 2011 at 18:59

3

Solved

I defined the following subroutine: Sub EnterCellValueMonthNumber(cells As range, number As Integer) range(cells).Select ActiveCell.FormulaR1C1 = number End Sub When I call the subroutine like...
Sacksen asked 6/6, 2011 at 12:52

4

Solved

I have heard that people shouldn't be using & to call Perl subs, i.e: function($a,$b,...); # opposed to &function($a,$b,...); I know for one the argument list becomes optional, but what ...
Maleate asked 28/8, 2009 at 14:32

2

Solved

If perlcritic says "having no returns in a sub is wrong", what is the alternative if they really aren't needed? I've developed two apparently bad habits: I explicitly assign variables to the '$...
Radiator asked 27/2, 2015 at 9:40

1

Solved

I recently updated my .f90 code to .f03, and I was expecting to see speedup because my older version involved many allocating and deallocating (7 3D arrays--45x45x45) at each iteration inside a do ...

1

Solved

This is fixed in Perl v5.22. Does Perl v5.18's lexical subroutines with sort? I finally had a use for them today where I had a complicated sorting routine that depends on the current position in...
Mayotte asked 13/1, 2015 at 2:10

1

I was under the impression that the main differences between subroutines and functions in Fortran was that functions returned values, while subroutines change some or all of the values passed as ar...
Amado asked 17/12, 2014 at 8:50

5

Solved

With prototypes, you can create a subroutine that accepts a block of code as its first parameter: sub example (&) { my $code_ref = shift; $code_ref->(); } example { print "Hello\n" }; H...
Nanette asked 20/11, 2014 at 16:44

9

Solved

I would like to expose all subs into my namespace without having to list them one at a time: @EXPORT = qw( firstsub secondsub third sub etc ); Using fully qualified names would require bunch of ...
Alphonsealphonsine asked 8/4, 2009 at 22:25

5

I have a program with a while loop which has several points where certain conditions require some action to be taken and then the remainder of the iteration to be skipped. As this is always going ...
Fettling asked 12/9, 2014 at 12:16

1

Solved

I'm new to Fortran but I'm trying to find a way that I can retrieve information from programs I've written without including them as subprograms within my new file. As of right now I have 4 subrout...
Cassimere asked 10/6, 2014 at 19:48

© 2022 - 2024 — McMap. All rights reserved.