Simple windowed application: Difference between revisions

demos more interesting bits of the language
(demos more interesting bits of the language)
Line 103:
Private lblClickCounter As Label
Private nClicks As Int = 0
Private aPlurals() As Object = Array As Object(Array As String("has","click"),Array As String("have","clicks"))
End Sub
 
Line 113 ⟶ 114:
Sub btnClickMe_Action
nClicks = nClicks + 1
Dim aPlural() As Object = aPlurals(IIF(nClicks=1,0,1))
lblClickCounter.Text = "There " & IIFaPlural(nClicks = 1, "has", "have"0) & " been " & (nClicks) & " " & IIFaPlural(nClicks=1, "click", "clicks") & " so far."
End Sub
 
Sub IIF(test As Boolean, trueTexttrueVal As StringObject, falseTextfalseVal As StringObject) As StringObject
If test Then
Return trueTexttrueVal
Else
Return falseTextfalseVal
End If
End Sub</lang>
Anonymous user