PSeInt Retornar: end a function with a value
Ends the function right there and hands the given value back to whoever called it.
- Group:
- Structures
- Template
Retornar
Opens the editor with this example loaded. Run it step by step and watch the flowchart.
Worked example
A complete algorithm, ready to copy and run.
Funcion r <- Maximo(a, b) Si a > b Entonces Retornar a FinSi Retornar bFinFuncionAlgoritmo Example Escribir Maximo(3, 9)FinAlgoritmoOutput
Maximo(3, 9) gives back 9.
This is what the console shows when the example runs.
9In a flowchart
This is how it appears in a flowchart, with the same shapes Codoritmo draws.
Template
The general form. Replace what's inside < > with your own data.
Retornar <valor>Examples that use it
Programs from the example library where it appears, from the simplest to the most complete.
Linear vs. Binary Search
Counts the comparisons each search needs on the same sorted list.
IntermediateFactorial and Power
Functions that compute a factorial and a power.
IntermediateReusable Validation
Validates the email and age on a sign-up form.
IntermediatePrime Numbers
Finds every prime number up to a limit.
IntermediateGCD and LCM
Computes the greatest common divisor and the least common multiple.
IntermediateQuicksort
Picks a pivot, splits smaller from larger values and sorts each side recursively.
Advanced
More structures
Codoritmo is an independent, open-source project inspired by PSeInt and compatible with its syntax. It is not affiliated with the PSeInt project. Official PSeInt website.