Type your ugBASIC program here (remember: keywords like PRINT must be UPPERCASE!).
Click on Build menu to select the target: you will download the compiled binary file!

CLS DIM a AS BYTE DIM b AS BYTE DIM i AS WORD DIM ti AS WORD PRINT "------------------------" PRINT "SPEED TEST" PRINT "IF + AND (16.000 cycles)" PRINT "------------------------" PRINT TIMER = 0 REM 1 if a=0 and b=0 then ti = TIMER FOR i=0 TO 16000 IF a=0 AND b=0 THEN NOP ENDIF NEXT ti = TIMER - ti PRINT "1) a=0 and b=0 : t = "; (ti / TICKS PER SECOND); " sec(s)" REM 2 if a=0 then if b=0 then ti = TIMER FOR i=0 TO 16000 IF a=0 THEN IF b=0 THEN NOP ENDIF ENDIF NEXT ti = TIMER - ti PRINT "2) a=0 then b=0 : t = "; (ti / TICKS PER SECOND); " sec(s)" REM 3 if (a=0)*(b=0)=1 then ti = TIMER FOR i=0 TO 16000 IF (a=0)*(b=0)=1 THEN NOP ENDIF NEXT ti = TIMER - ti PRINT "3) (a=0)*(b=0)=1 : t = "; (ti / TICKS PER SECOND); " sec(s)" REM 4 if a*a+b*b=0 then ti = TIMER FOR i=0 TO 16000 IF (a*a)+(b*b)=0 THEN NOP ENDIF NEXT ti = TIMER - ti PRINT "4) a*a+b*b=0 : t = "; (ti / TICKS PER SECOND); " sec(s)" REM 5 if abs(a)+abs(b)=0 then ti = TIMER FOR i=0 TO 16000 IF ABS(a)+ABS(b)=0 THEN NOP ENDIF NEXT ti = TIMER - ti PRINT "5) abs(a)+abs(b)=0 : t = "; (ti / TICKS PER SECOND); " sec(s)"

Welcome to the ugBASIC sandbox!

This tool was designed to quickly test whether the code you are writing compiles correctly and determines the desired results. Since the source is compiled thanks to dedicated servers, separate from the browser you are using, some commands are not available: for example, you cannot load external files or resources by using the LOAD command. If you need to develop a program with a complete tool, we recommend installing the executables or the UGBASIC-IDE.

Unless required by applicable law or agreed to in writing, this website is given on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.