User Tools

Site Tools


ugbasic:user:syntax
Translations of this page:


ugBASIC User Manual

Syntax

Keywords

The following keywords form the entire vocabulary of the language. The keywords must be written in UPPER case. Therefore PRINT is a valid command, while print is not.

 
 8BIT 16BIT 32BIT A Aa Ab Ac Ao Ag Ago 
 
 Al Alt Ap Ar AS Atm As Ak AT Ata 
 
 Ax Ad A# An Aw B Ba Bg BAG Ban 
 
 Bk BANKED Br Bar Bas Bss BEGIN Be Bel BELLS 
 
 Bn Bi Bt BIRD Bm Bl BLOWN Bu BOTTLE BOWED 
 BOX BRASS BREATH BRIGHT BRIGHTNESS Brn By Boo Bo Bf 
 C Ca CALLIOPE Cn Cp CAPSLOCK Cpl Cs Cd CELESTA 
 CELLO Ce CENTRE CHAR CHARANG CHIFF Ch CHOIR CHURCH Ci 
 CLARINET CLAVI CLEAN Clr Cle Cln Cli Cl Cm Co 
 
 Col COLECO COLON Cr COLOUR COLOURS Crs COLORMAP Com Clm 
 
 Cms COMMA C= COMPRESSED CONTRABASS Cmp C# Ctrl COUNT CPC 
 
 Crg CRSR CRYSTAL CSPRITE Cu Curs CYAN Cy Cyc CYMBAL 
 D Dk Da DEBUG DEC Dc Dft De Del Di 
 
 Dx DISTORTION Dl DRAWBAR DRUM DRUMS Dst Dv Do DO 
 
 Db Dw Dr Dg DULCIMER Dwd E ECHOES ECM ELECTRIC 
 
 Ell El Eif Em Emt END ENGLISH ENSEMBLE Ei Es 
 
 Ens En Eq EXACT Ex Exp Exx Ev Fa F 
 
 FILE Fil Fi FI FIDDLE FIFTHS FINGER FST Fl FLUTE 
 
 Fnt Fo Fr Frs Fre FRENCH FRET FRETLESS Fm Fu 
 FX G Gl Ge Gb GLOCKENSPIEL GOBLINS Gd Go Gs 
 GR GRAND Gr Gy Gre GREY GUITAR GUNSHOT H HALO 
 
 Ht Htd HARMONICA HARMONICS HARP HARPSICHORD HAS Hg HELICOPTER Hx 
 
 Hd Hdn HIT Hm HONKY Hz HORN Hs I IF 
 
 Ig Im Ims IN INC In Ik Iky Ip Ins 
 
 Inst Inv Ist IS J JAZZ Jd Jf Jl Jr 
 
 Ju Jy Jyc K KALIMBA Ky Ks Kt Ki KOTO 
 L La LEAD Lf LEN Le Lt Li Ln Ld 
 
 Lc Lk Lp Lw M Mg MARIMBA Mk Mx MCM 
 MELODIC Mm METALLIC Me Mi Mn Min Mb MOD M# 
 
 MONOCOLOUR Mv Mmv Mc MS MSX MILLISECONDS Mu Mcs MULTICOLOUR 
 
 Mus MUTED N Nx Nw NOISE No Nn Np Nt 
 
 Ne NYLON O OBOE OCARINA OF Of OOHS Ol ON 
 
 On OR Or ORCHESTRA ORCHESTRAL ORGAN OVERDRIVEN Ov P PAD 
 
 Pal PAN Pa Pr Pm Pc Pk Pn PERCUSSIVE Per 
 PIANO PICCOLO PICK Pik PIPE PIZZICATO Py Pl Plu Pt 
 
 Po Ply POLYSYNTH Pst Pnd Pp Pos POW Pw Px 
 PRINT Prc Prcd Pur Pu Q R RAIN Rd Rdm 
 
 Rst RAW R# RECORDER Re REED Rm Rend Rpt Rep 
 
 Rn Rt REVERSE RGB Rg RING RND ROCK Rl Rw 
 
 Rws RUNSTOP RUN S SAWTOOTH SAX Scn Scc Scs SCI 
 
 Sc Scl SEASHORE SECTION Sl SEMICOLON Sep Seq Se Sg 
 
 Shs SHAKUHACHI SHAMISEN SHANAI Sr SHIFT SHIFTS Sho Sh Sgnd 
 SITAR Sz SLAP SLASH SOPRANO So SOUNDTRACK Sp Sw Spr 
 SQUARE SQR Stt STEEL Stp St Str STR S1 STRINGS 
 
 Swp SWEEP SYNTH SYNTHBRASS SYNTHSTRINGS T Tb TAIKO Tn TANGO 
 
 Ts TELEPHONE Tmp TENOR Tx Txm Txa Th Thr Tk 
 TIMPANI TINKLE Tm Tl Tls Tse TI TIME Tmr TO 
 TOM TONK TREMOLO TROMBONE TRUMPET TUBA TUBULAR Tu Trs Tra 
 
 Tr TWEET Ty U Uq Un UP Up Ux Us 
 V Va Vr Vp Vb Vas Ve VIBRAPHONE Vd VIOLA 
 VIOLIN Vi Vs VOICE Vo Vscl W Wt wA WARM 
 
 We WHISTLE Wi Wd Wh Wht W# Wrt WOODBLOCK Wo 
 X XGR Xg XY XYLOPHONE Xr Xcs Xt Xp Y 
 YGR Yg YX Ycs Ye Yi Yt Yp Z ZX 

In ugBASIC (like CBM BASIC) you do not need to isolate keywords from each other or from other identifiers with any separator, like spaces.

Identifiers

Identifiers are used to give a name to labels, variables, constants, procedures and functions. You may choose any name for identifier. Anyway, you have to follow some rules:

  • the first character must be lowercase alphabetic;
  • the remaining characters can be uppercase;
  • the dollar symbol ($) identify string variables;
  • identifier are case sensitive: pippo and pIPPO are different symbols
  • they can be of any length, and all characters are significant.

Statements

Statements and commands can be separated using the colon symbol (:) character, and can end with LF or CR+LF characters. The separator is not required if there's only one statement in one line, as the following example:

 WHILE NOT finished : PRINT "continue" : WEND
 WHILE NOT finished
    PRINT "continue"
 WEND

Comments

If you begin a line with single quote (') character, or put it after colon symbol, it will be considered a comment until the end of the line. The same for the REM command, that is used to begin a comment.

 ' comment
 REM comment
 line = 1 :' comment
 line = 1 :REM comment

Whitespace

Whitespace (e.g. spaces and tabs) are ignored, since they are not needed. You are encouraged to use them if you need to make make the program more readable, or to remove it if you need to join competitions where number of lines is an important factor.

POWERED BY