Loop.. i think?

Cold 56 Reputation points
2021-02-08T01:10:15.91+00:00

One question: even tho it's not related to loop (I think) , however, what command will I use if I want for my program to never show "Press any key to continue" in the end and always have the space to write ([TextWindow.Read()]) until I close the window or use Program.End()?

Example: EX = TextWindow.Read()
If EX = 1
Program.End()
EndIf
If EX = 2
TextWindow.WriteLine("heyo")

whenever I finish that program and type 2 it will say heyo and the "Press any key to continue..." but I want to always be possible to rewrite an answear. If my explanation was a little confusing.. I just want to write all the time '-'

Small BASIC
Small BASIC
A programming language created by Microsoft that serves a stepping stone for beginners from block-based coding languages to more complex text-based languages.
280 questions
0 comments No comments
{count} votes

Accepted answer
  1. WhTurner 1,611 Reputation points
    2021-02-08T11:57:37.1+00:00

    Working without GOTO:

    While EX<>1
      EX = TextWindow.Read()
      If EX = 1 Then
        Program.End()
      EndIf
      If EX = 2 Then
        TextWindow.WriteLine("heyo")
      Else
        TextWindow.WriteLine(EX)
      EndIf
    EndWhile
    
    2 people found this answer helpful.

1 additional answer

Sort by: Most helpful
  1. Absolute Beginner 171 Reputation points
    2021-02-08T07:40:51.547+00:00

    (translated by Google translator)

    Hi Cold.
    I think now you can use the following code:

    MyLoop:
    EX = TextWindow.Read()
    
    If EX = 1 Then
      Program.End()
    Else
      TextWindow.WriteLine("hello")
      Goto MyLoop
    EndIf
    

    Then you will learn not to use the "Goto" command.

    I wish you success. :)

    2 people found this answer helpful.
    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.