This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public delegate TResult Converter(T input); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public delegate TResult Converter<T, TResult>(T input); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ListHandler | |
{ | |
private readonly IRepository _repository; | |
public ListHandler(IRepository repository) | |
{ | |
_repository = repository; | |
} | |
public ListMoviesViewModel Execute() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public ListMoviesViewModel ListHandler(inject IRepository repository) | |
{ | |
return new ListMoviesViewModel { Movies = _repository.Query<Movie>() }; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void Main() | |
Print("Hello, World!") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int Factorial(int n) | |
if (n==0) | |
1 | |
else | |
n * Factorial(n-1) | |
int Main() | |
Factorial(10) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int Main() | |
{ | |
int height = 5 | |
length = 10 | |
height * length | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Value types can be made nullable, like in C#: | |
int a = 1 | |
int? b = null | |
//But even reference types are non-nullable by default in Rook: | |
string str = null // Compile error! | |
string? nullableStr = null // OK |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int[] digits = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] | |
int[] firstFive = digits[0:5] | |
int[] lastFive = digits[5:10] | |
int[] interiorFive = digits[3:8] | |
firstFive.Append(100) // Equals [0, 1, 3, 4, 100] | |
interiorFive.With(2, 100) // Equals [3, 4, 100, 6, 7] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int[] digits = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] | |
int[] firstFive = digits[0:5] | |
int[] lastFive = digits[5:10] | |
int[] interiorFive = digits[3:8] | |
firstFive.Append(100) // Equals [0, 1, 3, 4, 100] | |
interiorFive.With(2, 100) // Equals [3, 4, 100, 6, 7] |