![]() | ![]() |
![]() | DC3 language is very similar to VB script; variables have no type and the type is implicit. It recognizes some internal functions: print, msgbox, inputbox, clng, cstr, exit, rnd You can define variables, functions, variables in the order you want and the compiler is not case sensitive. dim a="",b,c=&h10 You have declared a string variable 'a', a generic variable 'b' and a numeric variable c. sub message(a) msgbox (a) end sub message ("bye bye!") this small program shows a message box with the "bye bye!" string. function sum(a,b) sum=a+b end function msgbox (sum(10,10)+sum(20,20)) msgbox (sum("a","b")) this program returns 60 -> 10+10+20+20 and "ab" --> "a" + "b" dim a="hello " msgbox (a+"world") this sample shows "hello world" on the screen dim a=10 a++ msgbox (a) this sample returns 11 sub writenum(n) if n>0 then writenum(n-1) end if print(n) end sub writenum(10) this program writes 0,1,2,3,4,5,6,7,8,9,10 to the console using recursion. dim s s=inputbox ("Write your name") msgbox ("Your name is " + s) this program writes your name dim a=0,c=0 while (a<10) c+=a a++ wend msgbox (c) this program repeat a sum for 10 times returning 45 as result |