[tutor] こんにちは世界。 "Hello World"
- Posted by _tom (admin) Feb 26, 2019
- 1538 views
A console example
The oE|Phix programming languages are written in plain text.
You can use any people language for the name of your program file and string data.
In these examples I used google translate to make Euphoria programs that operate in Japanese.
-- oE include std/console.e atom answer = prompt_number("続行するには1を入力してください。", {} ) if answer = 1 then puts(1, "こんにちは世界。") else puts(1, "さようなら。" ) end if
Phix has "autoinclude" so it is a bit simpler.
--Phix atom answer = prompt_number("続行するには1を入力してください。", {} ) if answer = 1 then puts(1, "こんにちは世界。") else puts(1, "さようなら。" ) end if
Google translate provided
続行するには1を入力してください。 | Please enter 1 to continue. |
こんにちは世界。 | Hello world. |
さようなら。 | Goodbye. |
An example using oE and euGTK.
I saved the following file as こんにちは世界 . The file name こんにちは世界 now shows up in the title bar of the GTK window.
The "Quit" button is still English. You could invent your own buttons if you wish.
---------------------------------------------------------------------------- --# Yet Another Hello World! program ---------------------------------------------------------------------------- include GtkEngine.e constant --[1] create the widgets; win = create(GtkWindow,"border width=10,icon=face-laugh,$destroy=Quit"), pan = create(GtkBox,"orientation=vertical"), box = create(GtkButtonBox), btn = create(GtkButton,"gtk-quit", "Quit"), lbl = create(GtkLabel,"color=blue") --[2] style the label; set(lbl,"markup", -- style the text using basic html; "<b><u><span color='red'><big>こんにちは世界</big></span></u></b>\n\n" & "これは、ラベルと終了ボタンを持つ単純なウィンドウをデモします。\n") --[3] add widgets to containers; add(win,pan) add(pan,lbl) add(box,btn) pack(pan,-box) show_all(win) --[4] instantiate widgets; main() --[5] enter main processing loop;
You can customize an oE|Phix program for any people language with little effort. You do not have to fully understand UTF and fonts to make this happen.
_tom