'=================================================================================================== ' ' FizzBuzz ' ________ ' ------------------------------------------------------------------------------------ SuperStrict ' ------------------------------------------------------------------------------------ ' Brief. ' Write a program that prints the numbers from 1 To 100 ' But, For multiples of 3 Print "Fizz" instead of the number ' For the multiples of 5 Print "Buzz" instead of the number ' For numbers which are multiples of both 3 And 5 Print "FizzBuzz". ' ------------------------------------------------------------------------------------- '=================================================================================================== TConditReponse.RF_Create (3,"Fizz") 'First Condition TConditReponse.RF_Create (5,"Buzz") 'Second Condition For Local Iterater:Int = 1 To 100 Print TConditReponse.Result(Iterater) Next '=================================================================================================== Delay 1000 End '=================================================================================================== 'Conditions must be added in the order you wish them to be printed '=================================================================================================== Type TConditReponse 'Type to handle the conditions and responses ' -------------------------------------------------------------------- Field F_Divisaleby:Int 'The Divisable Condition Field F_Responce:String 'The String to be printed Global GF_List:TList = New TList 'A List of the conditions ' -------------------------------------------------------------------- Method RM_Set:TConditReponse(P_DivisableBy:Int,P_Responce:String) Self.F_Divisaleby = P_DivisableBy Self.F_Responce = P_Responce Self.GF_List.AddLast (Self) Return Self End Method ' ---------------------------------------------------------------------- Function RF_Create:TConditReponse(P_DivisableBy:Int,P_Responce:String) Return New TConditReponse.RM_Set(P_DivisableBy,P_Responce) EndFunction ' ---------------------------------------------------------------------- Method NumberIsDivisableBy:Int(P_Number:Int) 'Does the Number meet a condition If P_Number Mod Self.F_Divisaleby Return False Else Return True EndIf End Method ' ---------------------------------------------------------------------- Function result:String(P_Number:Int) 'Make the respose string Local Result:String = "" For Local Condition:TConditReponse = EachIn Self.GF_List If Condition.NumberIsDivisableBy (P_Number) Result:+Condition.F_Responce End If Next If Result = "" Then result = P_number Return Result End Function End Type '===================================================================================================