You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: README.md
+15-18
Original file line number
Diff line number
Diff line change
@@ -29,13 +29,14 @@ Comments and Documentation
29
29
30
30
Variables and Types
31
31
```
32
-
String hello = "Hello, World!"
32
+
// Variable names can contain spaces. Yes, really.
33
+
String hello world = "Hello, World!"
33
34
34
35
// Types can be inferred.
35
-
is_spring = true
36
+
is spring = True
36
37
37
38
// Types can depend on other types (Generic Types) or on values (Dependent Types).
38
-
Int(32) power_level = 9000
39
+
Int(32) power level = 9000
39
40
40
41
fun slice(Array arr, Int index < arr.length) Array(size=index):
41
42
// Or more explicitly as slice(Array arr, Int index if index < arr.length)
@@ -55,15 +56,15 @@ Conditions
55
56
```
56
57
// Informal has just a single conditional operator - the pattern-matching "if".
57
58
if sunny:
58
-
go_outside()
59
+
go outside()
59
60
else if rainy:
60
-
go_outside_with_umbrella()
61
+
go outside with umbrella()
61
62
else:
62
63
63
64
64
65
// You can use it as a switch case.
65
66
// Conditions are expressions, so you can capture their result and store it as a variable.
66
-
char_type = if ch:
67
+
char type = if ch:
67
68
' ': "ch is a Space"
68
69
'a'..'z' | 'A'..'Z': "ch is a Letter"
69
70
'0'..'9': "ch is a Digit"
@@ -87,9 +88,9 @@ if (n % 5, n % 3):
87
88
// Or specify each branch separately
88
89
if:
89
90
user.email:
90
-
send_confirmation_email(user.email)
91
-
user.phone or user.messenger_id:
92
-
send_confirmation_text(user)
91
+
send confirmation email(user.email)
92
+
user.phone OR user.messenger_id:
93
+
send confirmation text(user)
93
94
```
94
95
95
96
Array operators and functional constructs replace the need for most loops, but Informal still comes with a flexible for loop to process any kind of data.
0 commit comments