def a = 1 //local variable
b = 2 //global variable
a //error
b //this works
//closure example
timesTwo = {x -> x*2}
timesTwo(4)
timesTwo("Multiplying Strings!")
sin(3.1415)
import java.nio.charset.Charset;
byte[] cp1251Bytes = new byte[3];
cp1251Bytes[0] = (byte) 0xFD;
cp1251Bytes[1] = (byte) 0xFE;
cp1251Bytes[2] = (byte) 0xFF;
byte[] utfBytes = new byte[6];
utfBytes[0] = (byte) 0xD1;
utfBytes[1] = (byte) 0x8D;
utfBytes[2] = (byte) 0xD1;
utfBytes[3] = (byte) 0x8E;
utfBytes[4] = (byte) 0xD1;
utfBytes[5] = (byte) 0x8F;
String cp1251Str = new String(cp1251Bytes, Charset.forName("CP1251"));
byte[] utfBb = cp1251Str.getBytes(Charset.forName("UTF-8"));
for(byte b: utfBb){
System.out.print((String.format("%x", b)));
}
new Plot(
title: new String(cp1251Bytes, Charset.forName("CP1251")),
xLabel: new String(utfBb, Charset.forName("UTF-8")),
yLabel: new String(utfBytes, Charset.forName("UTF-8")))
3 + 2
// cell10
beakerx.getCodeCells('tg1')[0].outputs
// cell10 expected result
Image("../../resources/img/groovy/groovy/cell10_case1.png")
// cell11
lst = []
lst << ['hours':10]
// cell11 expected result
Image("../../resources/img/groovy/groovy/cell11_case1.png")
// cell12
[a: null, b:1]
// cell12 expected result
Image("../../resources/img/groovy/groovy/cell12_case1.png")
%%python
from beakerx import *
pp = Plot(title="Title", xLabel="Horizontal", yLabel="Vertical")
pp.add(Line(displayName="Line", x=[1, 4, 6, 8, 10],y=[3, 6, 4, 5, 9]))
press 'Tab' for autocomplete
press 'Shift' + 'Tab' for doc