We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
For.Loop()
1 parent 7b596d3 commit f33ce0eCopy full SHA for f33ce0e
Core/For.cs
@@ -2,11 +2,17 @@ namespace SteveSharp.Core;
2
3
public static class For
4
{
5
- public static string Loop(int from, int to, string create, string replaces = ""){
6
- string commands = "";
7
- for(int i = from; i <= to; i++){
8
- commands += create.Replace(replaces, i.ToString()) + '\n';
+ public static string Loop(int to, Func<int, List<String>> block, int from = 0) {
+ List<List<string>> fullBlock = new();
+ for(int i = from; i <= to; i++) {
+ fullBlock.Add(block(i));
9
}
10
- return commands;
+ List<string> ret = new();
11
+ foreach(var codeBlock in fullBlock) {
12
+ foreach(var command in codeBlock) {
13
+ ret.Add(command);
14
+ }
15
16
+ return string.Join("\n", ret);
17
18
0 commit comments