Asked • 04/24/19

What am I doing wrong so confused?

I am making a program in BASIC and I know its really bad and I can fix a lot of things but all I was wondering is why I am getting errors for ending subs? ' simple calculator declare sub main declare sub add declare sub subtract declare sub multiply declare sub divide declare sub question declare sub sendBack 'asks to send user back to main menu main sub main 'Where the user makes there selection  dim choice as integer  input "Welcome, would you like to 1.Add 2.Subtract 3.Multiply 4.Divide" ; choice  if choice = 1 then   add  elseif choice = 2 then   subtract  elseif choice = 3 then   multiply  elseif choice = 4 then   divide  else   print "Error 404 your choice does not exist, please enter a corresponding number!"   main end sub sub question 'Get 2 integers from user  dim num1 as integer  dim num2 as integer  input "Please enter your first number" ; num1  input "Please enter your second number" ; num 2 end sub sub add  question  print num1 + num2 end sub sub subtract  question  print num1 - num2 end sub sub multiply  question    print num1 * num2   end sub sub divide  question  print num1 / num2 end sub sub sendBack  dim answer  input "Would you like to make another calculation, 1.Yes, 2.No" ; answer  if input = 1 then   main  elseif input = 2   sleep  else   print "Please enter a valid choice, thankyou!" sleep end sub Errors I got ======= C:\\Users\\Harjit\\Documents\\Coding (Basic)\\calculator.bas(30) error 32: Expected 'END IF', found 'end' in 'end sub' C:\\Users\\Harjit\\Documents\\Coding (Basic)\\calculator.bas(34) error 60: Illegal inside functions, found 'sub' in 'sub question 'Get 2 integers from user' C:\\Users\\Harjit\\Documents\\Coding (Basic)\\calculator.bas(46) error 60: Illegal inside functions, found 'sub' in 'sub add' C:\\Users\\Harjit\\Documents\\Coding (Basic)\\calculator.bas(55) error 60: Illegal inside functions, found 'sub' in 'sub subtract' C:\\Users\\Harjit\\Documents\\Coding (Basic)\\calculator.bas(64) error 60: Illegal inside functions, found 'sub' in 'sub multiply' C:\\Users\\Harjit\\Documents\\Coding (Basic)\\calculator.bas(73) error 60: Illegal inside functions, found 'sub' in 'sub divide' C:\\Users\\Harjit\\Documents\\Coding (Basic)\\calculator.bas(82) error 60: Illegal inside functions, found 'sub' in 'sub sendBack' C:\\Users\\Harjit\\Documents\\Coding (Basic)\\calculator.bas(96) error 32: Expected 'END IF' in 'end sub'

1 Expert Answer

By:

Still looking for help? Get the right answer, fast.

Ask a question for free

Get a free answer to a quick problem.
Most questions answered within 4 hours.

OR

Find an Online Tutor Now

Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.