简体   繁体   中英

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?

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('#>>'))

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()

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM