Jump to content
IGNORED

if-then or if…then?


Random Terrain

Recommended Posts

Back in the 1980s, it seemed like just about every BASIC book used if-then, but on the Internet, it seems like if…then with an ellipsis is used more often, so I switched to using an ellipsis too. The problem is that if-then is much easier to type in and search for on a web page. I'm never going to memorize the Alt code for an ellipsis (Alt 0133), so I have to copy and paste any time I want to search the page for "if…then."

 

Does anyone have a problem with me changing if…then to if-then on the BASIC-related pages on my web site?

Link to comment
Share on other sites

… is an actual character instead of  ...? Pretty cool RT! I just did Alt 0133 to try that :)

I bet Google is likely able to match the three ASCII characters against the Ellipsis, maybe you could add both forms with one hidden to make it  easier to find on your BASIC pages.

 

Check out page 40 of the Radio Shack Color BASIC manual:

https://colorcomputerarchive.com/repo/Documents/Manuals/Hardware/Getting Started With Extended Color Basic (Tandy).pdf

 

They use an ellipsis, but I think it's the three ASCII period characters and not a single character.

 

What's strange though is in the back of that chapter though and throughout the book they use mathematical notation with THEN the denominator and IF the enumerator:

 

IF/THEN 

  • Like 1
Link to comment
Share on other sites

Speaking of if.. I've been told not to use 2 or more in the same line. Why?

 

For example:


 


 

  if player1y<76 then e=14 : if f{1} then e=13

 

vs


 

  if player1y<76 then e=14
  if player1y<76 && f{1} then e=13

-----------------------------------------------

Both of these examples seem to work perfectly fine in my code. The top example uses less memory.


 

But I have been advised to never use 2 or more if statements on the same line.


 

Why?


 

Is it because it's generally bad practice and can lead to confusing code?


 

Or does it actually cause a glitch and make the game crash upon reading? Because in terms of memory usage, if the top line reads correctly every time, obviously it would be preferable.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...