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
Conditional operator?
#5
(2014-09-16, 09:57 PM)einar Wrote:
Code:
IF (a < 30) THEN     LET a = a + 2 ELSE     LET a = a + 1 END IF

In Sinclair BASIC you can use AND and OR expressions for that.

In this case you'd need this:
LET a = ((a+2) AND (a < 30)) + ((a+1) AND (a >= 30))

Another example to truncate a float number:
LET n = -23.4
LET t = INT n + (1 AND SGN n = -1)

Unfortunately this doesn't work with Zx Basic Sad
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)