fork download
  1. Imports System
  2.  
  3. Public Class Test
  4.  
  5.  
  6. Dim mvArr As Variant
  7. Dim maResult() As String
  8. Dim maInclude() As Long
  9. Dim mlElementCount As Long
  10. Dim mlResultCount As Long
  11.  
  12. Public Shared Sub Main()
  13. ' your code goes here
  14. End Sub
  15.  
  16. Sub AllCombos()
  17.  
  18. Dim i As Long
  19.  
  20. 'Initialize arrays and variables
  21. Erase maInclude
  22. Erase maResult
  23. mlResultCount = 0
  24.  
  25. 'Create array of possible substrings
  26. mvArr = Array("NAME", "DESC", "DATE", "ACCOUNT")
  27.  
  28. 'Initialize variables based on size of array
  29. mlElementCount = UBound(mvArr)
  30. ReDim maInclude(LBound(mvArr) To UBound(mvArr))
  31. ReDim maResult(1 To 2 ^ (mlElementCount + 1))
  32.  
  33. 'Call the recursive function for the first time
  34. Eval 0
  35.  
  36. 'Print the results to the immediate window
  37. For i = LBound(maResult) To UBound(maResult)
  38. Console.WriteLine i, maResult(i)
  39. Next i
  40.  
  41. End Sub
  42.  
  43.  
  44. Sub Eval(ByVal lPosition As Long)
  45.  
  46. Dim sConcat As String
  47. Dim i As Long
  48.  
  49. If lPosition <= mlElementCount Then
  50. 'set the position to zero (don't include) and recurse
  51. maInclude(lPosition) = 0
  52. Eval lPosition + 1
  53.  
  54. 'set the position to one (include) and recurse
  55. maInclude(lPosition) = 1
  56. Eval lPosition + 1
  57. Else
  58. 'once lPosition exceeds the number of elements in the array
  59. 'concatenate all the substrings that have a corresponding 1
  60. 'in maInclude and store in results array
  61. mlResultCount = mlResultCount + 1
  62. For i = 0 To UBound(maInclude)
  63. If maInclude(i) = 1 Then
  64. sConcat = sConcat & mvArr(i) & Space(1)
  65. End If
  66. Next i
  67. sConcat = Trim(sConcat)
  68. maResult(mlResultCount) = sConcat
  69. End If
  70.  
  71. End Sub
  72.  
  73. End Class
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
Visual Basic.Net Compiler version 0.0.0.5943 (Mono 3.8 - tarball)
Copyright (C) 2004-2010 Rolf Bjarne Kvinge. All rights reserved.

/home/jyrZSo/prog.vb (6,21) : error VBNC30180: Keyword does not name a type.
/home/jyrZSo/prog.vb (7,4): Compiler error around this location, the compiler hasn't implemented the error message, nor error recovery, so the compiler will probably crash soon.
   at vbnc.Helper.ErrorRecoveryNotImplemented(Span Location)
   at vbnc.Parser.ParseVariableDeclarator(vbnc.ParsedObject Parent, Modifiers Modifiers, vbnc.ParseAttributableInfo Info, IList result, Boolean local)
   at vbnc.Parser.ParseTypeVariableDeclarator(vbnc.ParsedObject Parent, Modifiers Modifiers, vbnc.ParseAttributableInfo Info)
   at vbnc.Parser.ParseTypeVariableDeclarators(vbnc.ParsedObject Parent, Modifiers Modifiers, vbnc.ParseAttributableInfo Info)
   at vbnc.Parser.ParseTypeVariableMemberDeclaration(vbnc.ParsedObject Parent, vbnc.ParseAttributableInfo Info)
   at vbnc.Parser.ParseTypeMembers(vbnc.TypeDeclaration Parent)
   at vbnc.Parser.ParseClassDeclaration(vbnc.ParsedObject Parent, vbnc.Attributes Attributes, System.String Namespace)
   at vbnc.Parser.ParseTypeDeclaration(vbnc.ParsedObject Parent, vbnc.Attributes Attributes, System.String Namespace)
   at vbnc.Parser.ParseAssemblyMembers(vbnc.AssemblyDeclaration Parent, System.String RootNamespace)
   at vbnc.Parser.ParseAssemblyDeclaration(System.String RootNamespace, vbnc.AssemblyDeclaration assembly)
   at vbnc.Parser.Parse(System.String RootNamespace, vbnc.AssemblyDeclaration assembly)
   at vbnc.Compiler.Compile_Parse()
   at vbnc.Compiler.Compile()
   at vbnc.Compiler.Compile(System.String[] CommandLine)
   at vbnc.Main.Main(System.String[] CmdArgs)
/home/jyrZSo/prog.vb (30,44) : error VBNC90019: Expected ')'.
/home/jyrZSo/prog.vb (30,44): Compiler error around this location, the compiler hasn't implemented the error message, nor error recovery, so the compiler will probably crash soon.
   at vbnc.Helper.ErrorRecoveryNotImplemented(Span Location)
   at vbnc.Parser.ParseInvocationOrIndexExpression(vbnc.ParsedObject Parent, vbnc.Expression First)
   at vbnc.Parser.ParseIdentifier(vbnc.ExpressionParseInfo Info)
   at vbnc.Parser.ParseExponent(vbnc.ExpressionParseInfo Info)
   at vbnc.Parser.ParseUnaryPlusMinus(vbnc.ExpressionParseInfo Info)
   at vbnc.Parser.ParseMultDiv(vbnc.ExpressionParseInfo Info)
   at vbnc.Parser.ParseIntDiv(vbnc.ExpressionParseInfo Info)
   at vbnc.Parser.ParseMod(vbnc.ExpressionParseInfo Info)
   at vbnc.Parser.ParsePlusMinus(vbnc.ExpressionParseInfo Info)
   at vbnc.Parser.ParseConcat(vbnc.ExpressionParseInfo Info)
   at vbnc.Parser.ParseBitshift(vbnc.ExpressionParseInfo Info)
   at vbnc.Parser.ParseComparison(vbnc.ExpressionParseInfo Info)
   at vbnc.Parser.ParseNot(vbnc.ExpressionParseInfo Info)
   at vbnc.Parser.ParseAnd_AndAlso(vbnc.ExpressionParseInfo Info)
   at vbnc.Parser.ParseOr_OrElse_Xor(vbnc.ExpressionParseInfo Info)
   at vbnc.Parser.ParseExpression(vbnc.ParsedObject Parent)
   at vbnc.Parser.ParseRedimClause(vbnc.ParsedObject Parent)
   at vbnc.Parser.ParseList(vbnc.BaseList`1 List, vbnc.ParseDelegate_Parent`1 ParseMethod, vbnc.ParsedObject Parent)
   at vbnc.Parser.ParseRedimClauses(vbnc.ReDimStatement Parent)
   at vbnc.Parser.ParseReDimStatement(vbnc.ParsedObject Parent)
   at vbnc.Parser.ParseCodeBlock(vbnc.ParsedObject Parent, Boolean IsOneLiner)
   at vbnc.Parser.ParseSubDeclaration(vbnc.TypeDeclaration Parent, vbnc.ParseAttributableInfo Info)
   at vbnc.Parser.ParseTypeMembers(vbnc.TypeDeclaration Parent)
   at vbnc.Parser.ParseClassDeclaration(vbnc.ParsedObject Parent, vbnc.Attributes Attributes, System.String Namespace)
   at vbnc.Parser.ParseTypeDeclaration(vbnc.ParsedObject Parent, vbnc.Attributes Attributes, System.String Namespace)
   at vbnc.Parser.ParseAssemblyMembers(vbnc.AssemblyDeclaration Parent, System.String RootNamespace)
   at vbnc.Parser.ParseAssemblyDeclaration(System.String RootNamespace, vbnc.AssemblyDeclaration assembly)
   at vbnc.Parser.Parse(System.String RootNamespace, vbnc.AssemblyDeclaration assembly)
   at vbnc.Compiler.Compile_Parse()
   at vbnc.Compiler.Compile()
   at vbnc.Compiler.Compile(System.String[] CommandLine)
   at vbnc.Main.Main(System.String[] CmdArgs)
/home/jyrZSo/prog.vb (30,44) : error VBNC90019: Expected 'End'.
/home/jyrZSo/prog.vb (31,10) : error VBNC90019: Expected 'End'.
/home/jyrZSo/prog.vb (34,9) : error VBNC30203: Identifier expected.
/home/jyrZSo/prog.vb (37,8) : error VBNC30203: Identifier expected.
/home/jyrZSo/prog.vb (38,16) : error VBNC30203: Identifier expected.
/home/jyrZSo/prog.vb (39,9) : error VBNC30203: Identifier expected.
/home/jyrZSo/prog.vb (41,8) : error VBNC30203: Identifier expected.
/home/jyrZSo/prog.vb (44,4) : error VBNC30203: Identifier expected.
/home/jyrZSo/prog.vb (46,8) : error VBNC30203: Identifier expected.
/home/jyrZSo/prog.vb (47,8) : error VBNC30203: Identifier expected.
/home/jyrZSo/prog.vb (49,7) : error VBNC30203: Identifier expected.
/home/jyrZSo/prog.vb (51,18) : error VBNC30203: Identifier expected.
/home/jyrZSo/prog.vb (52,13) : error VBNC30203: Identifier expected.
/home/jyrZSo/prog.vb (55,18) : error VBNC30203: Identifier expected.
/home/jyrZSo/prog.vb (56,13) : error VBNC30203: Identifier expected.
/home/jyrZSo/prog.vb (57,9) : error VBNC30203: Identifier expected.
/home/jyrZSo/prog.vb (61,22) : error VBNC30203: Identifier expected.
/home/jyrZSo/prog.vb (62,12) : error VBNC30203: Identifier expected.
/home/jyrZSo/prog.vb (63,15) : error VBNC30203: Identifier expected.
/home/jyrZSo/prog.vb (64,24) : error VBNC30203: Identifier expected.
/home/jyrZSo/prog.vb (65,19) : error VBNC30203: Identifier expected.
/home/jyrZSo/prog.vb (66,13) : error VBNC30203: Identifier expected.
/home/jyrZSo/prog.vb (67,16) : error VBNC30203: Identifier expected.
/home/jyrZSo/prog.vb (68,17) : error VBNC30203: Identifier expected.
/home/jyrZSo/prog.vb (69,11) : error VBNC30203: Identifier expected.
/home/jyrZSo/prog.vb (71,8) : error VBNC30203: Identifier expected.
/home/jyrZSo/prog.vb (73,10) : error VBNC30203: Identifier expected.
There were 29 errors and 0 warnings.
Compilation took 00:00:00.6525530
stdout
Standard output is empty