September 2017 Update

This commit is contained in:
Ingy döt Net 2017-09-23 10:01:46 +02:00
parent bba7bfd280
commit ba8067c3b7
14570 changed files with 153136 additions and 63871 deletions

View file

@ -1,7 +1,7 @@
#import system.
import extensions.
#symbol program =
program =
[
#var s := "Mary had a @@x lamb." replace &literal:"@@x" &literal:"little".
console writeLine:s.
var s := "little".
console printLineFormatted("Mary had a {0} lamb.",s); readChar.
].

View file

@ -0,0 +1,5 @@
Public Sub Main()
Print Subst("Mary had a &1 lamb", "little")
End

View file

@ -0,0 +1,6 @@
#listix#
<how> //little
<what> //has a @<how> lamb
<main> //Mary @<what>

View file

@ -0,0 +1,14 @@
// version 1.0.6
fun main(args: Array<String>) {
val s = "little"
// String interpolation using a simple variable
println("Mary had a $s lamb")
// String interpolation using an expression (need to wrap it in braces)
println("Mary had a ${s.toUpperCase()} lamb")
// However if a simple variable is immediately followed by a letter, digit or underscore
// it must be treated as an expression
println("Mary had a ${s}r lamb") // not $sr
}

View file

@ -1,5 +0,0 @@
import strutils
var str = "little"
echo "Mary had a $# lamb" % [str]
# doesn't need an array for one substitution, but use an array for multiple substitutions

View file

@ -1,2 +0,0 @@
val extra = "little"
val result = s"Mary had a $extra lamb."

View file

@ -1,3 +0,0 @@
val original = "Mary had a %s lamb."
val extra = "little"
original format extra

View file

@ -0,0 +1 @@
"Mary had a X lamb.".replace("X","big")