In [7]:
// A basic C++ cell
// define a beaker_main function with an optional parameter for the return value
#include <iostream>
void beaker_main(){
std::cout << "Hello world 1!" << std::endl;
return;
}
Out[7]:
In [3]:
// A basic C++ cell
// define a beaker_main function with an optional parameter for the return value
#include <iostream>
void beaker_main(){
std::cout << "Hello world 2!" << std::endl;
return;
}
Out[3]:
In [5]:
// You can define functions
#include <string>
std::string distant;
void setDistant(){
distant = std::string("This is far away");
}
Out[5]:
In [6]:
// right now we don't support this functionality (https://github.com/twosigma/beakerx/issues/5228)
// and call functions defined in other C++ cells
#include <string>
#include <iostream>
extern std::string distant;
extern void setDistant();
void beaker_main(std::string &ret){
setDistant();
ret = distant;
}
Out[6]:
In [ ]: