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 firstbs AS SIGNED BYTE, secondbs AS SIGNED BYTE DIM firstbu AS BYTE, secondbu AS BYTE DIM firstws AS SIGNED WORD, secondws AS SIGNED WORD DIM firstwu AS WORD, secondwu AS WORD DIM firstds AS SIGNED DWORD, secondds AS SIGNED DWORD DIM firstdu AS DWORD, seconddu AS DWORD firstbs = -42: secondbs = 24 firstbu = 42: secondbu = 24 firstws = -4200: secondws = 2400 firstwu = 4200: secondwu = 2400 firstds = -1024000: secondds = 204800 firstdu = 1024000: seconddu = 204800 SWAP firstbs, secondbs SWAP firstbu, secondbu SWAP firstws, secondws SWAP firstwu, secondwu SWAP firstds, secondds SWAP firstdu, seconddu PRINT "BYTE SIGNED:"; IF firstbs = 24 THEN PRINT "OK (1) "; ELSE PRINT "FAIL (1) = ";firstbs ENDIF IF secondbs = -42 THEN PRINT "OK (2) "; ELSE PRINT "FAIL (2) = ";secondbs ENDIF PRINT PRINT "BYTE UNSIGNED:"; IF firstbu = 24 THEN PRINT "OK (1) "; ELSE PRINT "FAIL (2) = ";firstbu ENDIF IF secondbu = 42 THEN PRINT "OK (2) "; ENDIF PRINT PRINT "WORD SIGNED:"; IF firstws = 2400 THEN PRINT "OK (1) "; ENDIF IF secondws = -4200 THEN PRINT "OK (2) "; ENDIF PRINT PRINT "WORD UNSIGNED:"; IF firstwu = 2400 THEN PRINT "OK (1) "; ENDIF IF secondwu = 4200 THEN PRINT "OK (2) "; ENDIF PRINT PRINT "DWORD SIGNED:"; IF firstds = 204800 THEN PRINT "OK (1) "; ENDIF IF secondds = -1024000 THEN PRINT "OK (2) "; ENDIF PRINT PRINT "DWORD UNSIGNED:"; IF firstdu = 204800 THEN PRINT "OK (1) "; ENDIF IF seconddu = 1024000 THEN PRINT "OK (2) "; ENDIF

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.