Very simplified:
You basically need to follow the syntax dictated by the Ruby Programming Language.
Beside the simple math ( 3*Math.sin(Math::PI/3) + 23
) - which is not really different than, for example the functions in excel sheet - the Ruby Console can use, interpret and execute, methods, methods in Modules, Classes…etc.
https://developer.sketchup.com/developers/ruby-console
(Perhaps The Automatic SketchUp could be your start to get usage of the Console. However several other regards, this book a way much outdated…)