'Interpreter not working

def main():
cmd = (raw_input('#>>'))
if cmd=="SND_CMD_CREDITS":
    print "This language is made by Biohazard166 (Bioclassic23) or Dreadlurker36"
    main()

if cmd=="SND_CMD_HELP":
  print"Unfinsihed"
main()
if cmd=="SND_CMD_VER":
  print"This language is in VrPre-Alpha TEST PHASE 1"
  main()

else:
    print cmd,
    print " unknown command."
    main()
    print "Dreadscript Shell"
    main()

everything from the SND_CMD_VER down does not work it does not even display an error message at all as the error msg is "unknown command" is the scripting wrong or is there a bug thats so obvious it makes me look like an idiot?



Solution 1:[1]

Fix your indentation and make sure your program flows through if statements correctly.

Even first 2 lines should throw error now:

def main():
cmd = (raw_input('#>>'))

The correct notation is:

def main():
    cmd = (raw_input('#>>'))

Solution 2:[2]

Your indentation are horrendus. Let me re-write your entire program.

def main():
    cmd = (input('#>>'))
    if cmd=="SND_CMD_CREDITS":
        print("This language is made by Biohazard166 (Bioclassic23) or Dreadlurker36")
        main()

    if cmd=="SND_CMD_HELP":
        print("Unfinsihed")
        main()
    if cmd=="SND_CMD_VER":
        print("This language is in VrPre-Alpha TEST PHASE 1")
        main()

    else:
        print(cmd),
        print(" unknown command.")
        main()
        print("Dreadscript Shell")
        main()

main()

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Qback
Solution 2