-
Notifications
You must be signed in to change notification settings - Fork 1
Basic syntax
You can make multiple lines in one statement. E.g. statement1 ; statement2
. In this case, the shell just prints a list of results.
Numbers can be written under these forms:
123
-123
+123
12.3
-12.3
+12.3
123e2
-123e2
+123e2
12.3e2
-12.3e2
+12.3e2
123e-2
123e+2
12.3e+2
Other bases:
-
0b01110
(base 2, binary) -
0o17403
(base 8, octal) -
0x4EF1A
(base 16, hexadecimal) 0b10e30
0o70e30
Note that 0xA0e30
will be interpreted as the hexadecimal number A0E30
. (3*16^1 + 15*16^2 + 10*16^4
)
Note that you can put as much underscores (_
) as you want in a number (ex: 10_694_254
is the same as 10694254
)
There are two comment types: single- and multi-line. Here an example of both:
# this is a single-line comment
some_code # this is a single-line comment at the end of a line
some_other_code /* this is a multi-line comment
isn’t it?
pretty cool
*/
Intrestingly, you can also do some weird things like:
/* comment */ some_code # comment
some_code * (1 + /* comment */ 2) * /*comment*/ some_other_code
Not the best to start programming, but it has to be documented.
Use $identifier
to print and return the value of the variable identifier
. If it doesn’t exist, prints and returns the sring "$identifier"
. If no identifier is given, prints and returns the string "$"
.