Posts

Showing posts from June, 2016

If Sample

' These are samples for keywords of If statement.

' If - Then - EndIf

If 3 < Math.Pi Then
  TextWindow.WriteLine("3 < π")     ' 3 < π
EndIf

' Else

n = 1
If 0 < n Then
  TextWindow.WriteLine(n + " > 0")  ' 1 > 0
Else
  TextWindow.WriteLine(n + " ≦ 0")
EndIf

' ElseIf

n = -1
If 0 < n Then
  TextWindow.WriteLine(n + " > 0")
ElseIf n = 0 Then
  TextWindow.WriteLine(n + " = 0")
Else
  TextWindow.WriteLine(n + " < 0")  ' -1 < 0
EndIf

Array Sample

' These are samples for Array object and arrays.

' To set value to array

shape["shape"] = "Rectangle"  ' set value
shape["color"] = "Lime"       ' set value
TextWindow.WriteLine(shape)   ' shape=Rectangle;color=Lime;

' To get value from array

shape["color"] = "Lime"       ' set value
color = shape["color"]        ' get value
TextWindow.WriteLine(color)   ' Lime

' To remove value from array

shape["shape"] = "Rectangle"  ' set value
shape["color"] = "Lime"       ' set value
shape["color"] = ""           ' remove value
TextWindow.WriteLine(shape)   ' shape=Rectangle;

' ContainsIndex operation

param["x"] = 200
param["y"] = 100
If Array.ContainsIndex(param, "x") Then
  TextWindow.WriteLine(param["x"])  ' 200
EndIf

' ContainsValue operation

param["x"] = 200
param["…

Sample Code

I'd like to start new challenge: to write simple sample code for all keywords / operators / objects (properties / operations / events) in Small Basic programming language.

So, I will update following indices.
Last update: 2016-07-24
Keywords If Then ElseIf Else EndIfFor To Step EndForWhile EndWhileSub EndSubGoto Operators =+ - * /And Or Objects ArrayClockControlsDesktopDictionaryFileFlickrGraphicsWindowImageListKinectBodyListKinectFaceListKinectWindowMathMouse (Drag and Drop)NetworkProgramShapesSoundStackTextTextWindowTimerTurtle

Orbit

Image

Impossible Stairs

Image

Menger Sponge

Image

Gemini

Image