-
-
Save trashvin/daf5725097da672663dc2598cdb4e63e to your computer and use it in GitHub Desktop.
The "code" from Power Automate Desktop to demonstrate recursion when solving the factorial of a number. NOTE: you need to recreate the flow by pasting the code below in PAD. #DesktopFlowAsCode
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# if you're reading this code, create a subflow named "compute_factorial" in PAd and paste this code. | |
SET result TO number | |
LABEL REPEAT_STEP | |
IF number = 1 THEN | |
EXIT FUNCTION | |
ELSE | |
SET result TO result * (number - 1) | |
SET number TO number - 1 | |
GOTO REPEAT_STEP | |
END |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# copy this codes to the Main flow in PAD. you may need to create the "theInput" input variable | |
Text.ToNumber Text: theNumber Number=> number | |
CALL compute_factorial | |
Display.ShowMessage Title: $'''Result''' Message: $'''Factorial = %result%''' Icon: Display.Icon.Information Buttons: Display.Buttons.OK DefaultButton: Display.DefaultButton.Button1 IsTopMost: False ButtonPressed=> ButtonPressed |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment