title: How to end a program with an if statement?
body: <p>So this is a function from a slot machine project I'm working on. and I'm wondering is there a way to work it so that after the if statement claiming "your credits are too low to play" the program ends. Also can I make it so the program asks for the bet again if bet>credits or bet&lt;2 any answers appreciated. </p>
  
  <pre><code>slot validate( slot s)
  {
      printf ("Your available credit is %f\n", credits);
      if (credits &gt;= 2)
      {
          printf ("How many credits would you like to bet?\n");
          scanf("%f", &amp;s.bet);
          if (s.bet&gt; credits)
          {
              printf("you do not have enough credits for that bet\n");
              printf("your available credits are %f", credits);
          }
  
          if (s.bet &lt; 2)
          {
              printf("Error! You must bet at least to credits to play!");
          }
  
          if (credits &lt; 2)
          {
              printf ("your credits are too low to play!");
          }
      }
  
      return s;
  }
  </code></pre>