Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

python loop function in cs

description: Python can loop functions in eachother. can cS loop function too?

Example python:

def func():
   x=input(">")
   func()

Example c# expected:

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

namespace f
{class f{
   static void main(string[] args){
      void stuff() {
         Console.readLine()
         stuff()
      }
   }
}}

i dont think its possible to loop function in the function in cs.

what i mean by looping function is by putting the void inside the container. here is what i mean python:

def g():
   x=input(">")
   g()

output (typer):

Python Latest Update
>h
>bruh
>new line
>new new line
>line
>infinite input lines
> repeating function

i use this because in python i added commands in the script and i do it so i wont need to retype until the python stops the input.

example:

Problem (python script):
def func():
   x=input(">")
   if x=="help":
      print("commands: help")
      x=input(">")
      if x=="help":
         #repeat

Solution (python script):
def func():
   x=input(">")
   if x=="help":
      print("commands: help")
      func()

why i put the examples in python script: idk if you can do this in c# so im not going to confuse anyone

Can this happen in C#?

>Solution :

I’m not familiar with C# but hopefully this page can help Recursive Function C#

What you’re trying to make is called a recursive function

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading