Hello world/Newbie: Difference between revisions

→‎{{header|Phix}}: added browser and GUI sections
No edit summary
(→‎{{header|Phix}}: added browser and GUI sections)
Line 1,818:
The output will appear in the command prompt/terminal.<br>
Note: you can also save the file anywhere and press F5 in edita/edix to run it, however unless
you add {}=wait_key() or similar, the output (window) will immediately disappear.
 
'''Linux'''
Line 1,834:
You can also save the file anywhere and press F5 in edix to run it.<br>
The output will appear in the command prompt/terminal.
 
'''Browser'''
 
Once you have either of the above up and running, run pwa/p2js.exw then select an existing file or paste in
<!--<lang Phix>-->
<span style="color: #7060A8;">puts</span><span style="color: #0000FF;">(</span><span style="color: #000000;">1</span><span style="color: #0000FF;">,</span><span style="color: #008000;">"Hello world!"</span><span style="color: #0000FF;">)</span>
<!--</lang>-->
and press F5, which will create/overwrite pwa/test.htm and open it in your browser. Alternatively you can use Ctrl W to show/overwrite only, and then refresh an already open browser tab.
One day I hope to have that runnable in a browser and online, and probably have some command line packaging options.
 
'''GUI'''
 
If showing a little bit of text is one thing, the next has to be running a proper GUI application. The distribution includes
<!--<lang Phix>(phixonline)-->
<span style="color: #000080;font-style:italic;">--
-- pwa\phix\hello_world.exw
-- ========================
--</span>
<span style="color: #008080;">with</span> <span style="color: #008080;">javascript_semantics</span>
<span style="color: #008080;">include</span> <span style="color: #000000;">pGUI</span><span style="color: #0000FF;">.</span><span style="color: #000000;">e</span>
<span style="color: #7060A8;">IupOpen</span><span style="color: #0000FF;">()</span>
<span style="color: #004080;">Ihandle</span> <span style="color: #000000;">lbl</span> <span style="color: #0000FF;">=</span> <span style="color: #7060A8;">IupFlatLabel</span><span style="color: #0000FF;">(</span><span style="color: #008000;">"World!"</span><span style="color: #0000FF;">,</span><span style="color: #008000;">"EXPAND=YES, ALIGNMENT=ACENTER"</span><span style="color: #0000FF;">)</span>
<span style="color: #004080;">Ihandln</span> <span style="color: #000000;">dlg</span> <span style="color: #0000FF;">=</span> <span style="color: #7060A8;">IupDialog</span><span style="color: #0000FF;">(</span><span style="color: #000000;">lbl</span><span style="color: #0000FF;">,</span><span style="color: #008000;">"TITLE=Hello, RASTERSIZE=215x85"</span><span style="color: #0000FF;">)</span>
<span style="color: #7060A8;">IupShow</span><span style="color: #0000FF;">(</span><span style="color: #000000;">dlg</span><span style="color: #0000FF;">)</span>
<span style="color: #008080;">if</span> <span style="color: #7060A8;">platform</span><span style="color: #0000FF;">()!=</span><span style="color: #004600;">JS</span> <span style="color: #008080;">then</span>
<span style="color: #7060A8;">IupMainLoop</span><span style="color: #0000FF;">()</span>
<span style="color: #000000;">dlg</span> <span style="color: #0000FF;">=</span> <span style="color: #7060A8;">IupDestroy</span><span style="color: #0000FF;">(</span><span style="color: #000000;">dlg</span><span style="color: #0000FF;">)</span>
<span style="color: #7060A8;">IupClose</span><span style="color: #0000FF;">()</span>
<span style="color: #008080;">end</span> <span style="color: #008080;">if</span>
<!--</lang>-->
and you can run that without any further ado, at least on Windows, or online [http://phix.x10.mx/p2js/hello_world.htm here]. A few improvements are probably warranted, as in changes to pGUI.js and/or pGUI.css, but at least the language/transpiler side of things is pretty much complete. On Linux you would have to install IUP, following their standard instructions, which any proper Linux person should find easy-peasy, right, though I usually struggle a bit, and some quite a lot.
 
=={{header|PHP}}==
7,820

edits