Translation guide
A subprogram is a self-contained unit of code within a larger program, such as a function, subroutine, or procedure. In Japanese, the most common term is サブプログラム, but depending on context, more specific words like 関数 (function) or サブルーチン (subroutine) may be used.
The learner wants to refer to any self-contained code unit (function, procedure, subroutine) in a program.
A direct loanword from English, widely understood in programming contexts. It is a general term covering functions, subroutines, and procedures.
This subprogram is called from the main program.
A less common Japanese translation using 副 (sub-) and プログラム (program). It is understood but sounds more formal or technical.
Discuss the design of subprograms.
The learner specifically means a subprogram that computes and returns a value, like a mathematical function.
The standard term for a function in programming. It implies a subprogram that returns a value. Used in most programming languages.
This function returns an integer.
The learner means a subprogram that performs a task but may not return a value, often called a subroutine or procedure.
The standard loanword for subroutine. It is used in many programming contexts, especially older or procedural languages.
Call a subroutine to process the data.
A Japanese translation for 'procedure'. It is used in some academic or older texts but is less common in modern programming jargon.
The learner means a subprogram that belongs to a class or object.
The standard term for a method in object-oriented programming. It is a function associated with an object.
This class has three methods.
サブプログラム is a broad term that encompasses both functions and subroutines. 関数 specifically implies a return value, while サブルーチン may or may not return a value. In modern programming, 関数 is often used even for subroutines that don't return a value (e.g., void functions).
In C, all subprograms are defined as functions.
In many modern programming contexts, 関数 is the default term for any named block of code, even if it doesn't return a value. Unless you need to emphasize the distinction, 関数 is safe.
手続き型プログラミングでは、手続きが基本単位です。
In procedural programming, procedures are the basic unit.