In [30]:
local x::Bool = true
Out[30]:
In [33]:
let
local x::Bool = 2
end
In [7]:
x = true; typeof(x)
Out[7]:
In [8]:
1 < 2
Out[8]:
In [11]:
# Chaining of (in)equalities is possible
1 < 2 == 2 > 0
Out[11]:
In [2]:
x = 1; typeof(x)
Out[2]:
In [3]:
x = 1.0; typeof(x)
Out[3]:
In [6]:
x = 1.0 + 1.0im; typeof(x)
Out[6]:
In [12]:
x = 1 + 1im; typeof(x)
Out[12]:
In [4]:
x = 2//3; typeof(x)
Out[4]:
In [20]:
x = "Foo"; typeof(x)
Out[20]:
In [17]:
y = 'F'; typeof(y)
Out[17]:
In [24]:
x * "Bar"
Out[24]:
In [35]:
1 + 2
Out[35]:
In [36]:
1 - 2
Out[36]:
In [37]:
1 / 2
Out[37]:
In [38]:
1 * 2
Out[38]:
In [42]:
5 % 2
Out[42]:
In [44]:
sin(2)
Out[44]:
In [46]:
log(1)
Out[46]:
In [48]:
exp(1)
Out[48]:
In [51]:
sqrt(3)
Out[51]:
In [53]:
"Foo" * "Bar"
Out[53]:
In [54]:
x = 1.0; "x = $(x)"
Out[54]:
In [56]:
"x + 1 = $(x + 1)"
Out[56]:
In [57]:
split("Euler,Gauss,Newton",",")
Out[57]:
In [60]:
strip(" Julia
")
Out[60]:
In [61]:
replace("This is soooo lame!","lame","cool")
Out[61]:
In [89]:
re = r"x=\d+"; typeof(re)
Out[89]:
In [90]:
ismatch(re,"It might be true, that x=123 and y=4;")
Out[90]:
In [91]:
ismatch(re,"It might be true, that x>0 and y=4;")
Out[91]:
In [1]:
replace( "x=1.0; y=2.123; z=2",
r"y=(\d+)(\.?\d?)" ,
s"y1=\1; y2=0\2" )
Out[1]:
We picked up the following encrypted message from a super secret agency who must not be named.
"Whc1atzcd,th3mc1and5zcc1anzc1ac1an5w,th3r,zc1abc1utzcc1a5k5zcn,thozc1aqc1u,th35t,thi,thon5?"
Fortunately we recently aquired the instructions how to decipher the message. The required steps have to be performed in the given order and are as follows:
Decipher the message.
Hint: r"[aou]" matches the vowels a,o or u. r".{3}" matches any three characters.
In [15]:
riddle = replace("What demands an answer, but asks no questions?"," ","za")
riddle = replace(riddle," ","zc")
riddle = replace(riddle,r"([au])",s"cl\1")
riddle = replace(riddle,r"([oei])",s"nth\1")
riddle = replace(riddle,"l","1")
riddle = replace(riddle,"e","3")
riddle = replace(riddle,"s","5")
display(riddle)
riddle = replace(riddle,"1","l")
riddle = replace(riddle,"3","e")
riddle = replace(riddle,"5","s")
riddle = replace(riddle,r".{2}([au])",s"\1")
riddle = replace(riddle,r".{3}([oei])",s"\1")
riddle = replace(riddle,r"z[ac]"," ")
Out[15]: