The following warnings occurred:
Warning [2] Undefined array key 0 - Line: 1677 - File: showthread.php PHP 8.2.31 (Linux)
File Line Function
/inc/class_error.php 157 errorHandler->error
/showthread.php 1677 errorHandler->error_callback
/showthread.php 916 buildtree




Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
ELSIF
#1
For instance, suppose a game with 5 levels of difficulty, that needs to perform certain tasks depending on this. In ZX BASIC it will look like this:

Code:
IF level = 1 THEN ... ELSE IF level = 2 THEN ... ELSE IF level = 3 THEN ... ELSE IF level = 4 THEN ... ELSE ... END IF END IF END IF END IF

My suggestion is to add a new keyword "ELSIF", so the code above could be simplified as follows:

Code:
IF level = 1 THEN ... ELSIF level = 2 THEN ... ELSIF level = 3 THEN ... ELSIF level = 4 THEN ... ELSE ... END IF

I know this is not an important feature (the kind of stuff they call "syntactic sugar"), but since this is probably very easy to implement in the compiler and should be very convenient for several programs, I'm suggesting it anyway Smile
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 2 Guest(s)