Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Šovljanski - beskonačna petlja bez goto-a
//Rextester.Program.Main is the entry point for your code. Don't change it. //Compiler version 4.0.30319.17929 for Microsoft (R) .NET Framework 4.5 using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; namespace Rextester { public class Program { private int _checkACounter = 0; private int _checkBCounter = 0; private int _methodACounter = 0; public static void Main(string[] args) { var program = new Program(); var shouldExecuteMethodA = true; do { do { if (shouldExecuteMethodA) { program.MethodA(); } shouldExecuteMethodA = true; } while (!program.CheckA()); shouldExecuteMethodA = false; } while(!program.CheckB()); } public void MethodA() { Console.WriteLine("Method invocation: A. Invocation count: {0}", ++_methodACounter); } public bool CheckA() { Console.WriteLine("Check A called. Invocation count: {0}", ++_checkACounter); return _checkACounter % 3 == 0; } public bool CheckB() { Console.WriteLine("Check B called. Invocation count: {0}", ++_checkBCounter); return _checkBCounter > 4; } } }
run
|
edit
|
history
|
help
0
Sri 19 Sept
pared 1
Bridge Design Patern
convert a string of numbers to a list then use a forEach to loop through the list
FirstNonRepeatCharOfString
dcsdasxsdcdf
GYT
Calculate X and Y using Lambda Expressions
2.10.4
Get Bytecent Price in $USD