code example

Trying ways of displaying code…

The following code was inserted with the wp_codeshield Developer Formatter plugin:

To edit the way code is displayed go to Settings > Developer Formatter… (CSS access)

 Visual Basic |  copy code |? 
01
Option Explicit
02
 
03
Call Main()
04
 
05
Sub Main()
06
 
07
Dim bread
08
Dim butter
09
Dim ham
10
 
11
bread = Rhino.GetString (”Enter the kind of bread: “)
12
butter = Rhino.GetString(”Enter the kind of butter: “)
13
ham = Rhino.GetString(”Enter the kind of ham: “)
14
 
15
Call sandwich(bread, butter, ham)
16
 
17
End Sub
18
 
19
Function sandwich(bread, butter, ham)
20
 
21
Rhino.MessageBox “Your sandwich ingredients: “_
22
& bread & ” bread, “_
23
& butter & ” butter, and ” & ham & ” ham.”
24
 
25
End Function

And this code too (with indentation):

 Visual Basic |  copy code |? 
01
02
Option Explicit
03
Call Main()
04
  Sub Main()
05
    ‘Variable Declaratio
06
    Dim point(2)
07
    Dim i, j, k, l
08
    Dim points(15,15)
09
    Dim resultOfAddition
10
 
11
    ‘Assigning values to variables
12
    point(0) = 0
13
    point(1) = 0
14
    point(2) = 0
15
 
16
    ' Iteration
17
    ‘ Storing points in a two dimensional array
18
    For i = 0 To 15
19
 For j = 0 To 15
20
          point(0) = j
21
   point(1) = i
22
   points(i,j) = Array( point(0), point(1), point(2) )
23
        Next
24
    Next
25
 
26
    Call myDrawFunction(points)
27
 
28
  End Sub
29
 
30
Function myDrawFunction(points)
31
 Dim k, l
32
 ‘ Drawing points
33
 	For k = 0 To 15		
34
   For l = 0 To 15
35
     Rhino.AddPoint points(k,l)
36
            Rhino.Sleep(20)
37
  Next	
38
        Next
39
End Function
40
 
41

Another option:

01
Function myDrawFunction(points)
02
  Dim k, l
03
  ‘ Drawing points
	
04
  For k = 0 To 15
		
05
    For l = 0 To 15
06
 Rhino.AddPoint points(k,l)
	
07
 Rhino.Sleep(20)
		
08
    Next
09
  Next
10
 End Function
11


This post is tagged

Leave a Reply

You must be logged in to post a comment.





Configure Widgets

Categories

Configure Widgets