langs a-z
This commit is contained in:
parent
db842d013d
commit
d066446780
11389 changed files with 98361 additions and 1020 deletions
|
|
@ -0,0 +1,3 @@
|
|||
varname = input ("Enter variable name: ", "s");
|
||||
value = input ("Enter value: ", "s");
|
||||
eval([varname,"=",value]);
|
||||
|
|
@ -0,0 +1 @@
|
|||
eval(Str(input(), "=34"))
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
my $vname = prompt 'Variable name: ';
|
||||
$GLOBAL::($vname) = 42;
|
||||
say $GLOBAL::($vname);
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
$variableName = Read-Host
|
||||
New-Variable $variableName 'Foo'
|
||||
Get-Variable $variableName
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
editvar /newvar /value=a /userinput=1 /title=Enter a variable name:
|
||||
editvar /newvar /value=b /userinput=1 /title=Enter a variable title:
|
||||
editvar /newvar /value=-a- /title=-b-
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
REBOL [
|
||||
Title: "Dynamic Variable Name"
|
||||
Author: oofoe
|
||||
Date: 2009-12-28
|
||||
URL: http://rosettacode.org/wiki/Dynamic_variable_names
|
||||
]
|
||||
|
||||
; Here, I ask the user for a name, then convert it to a word and
|
||||
; assign the value "Hello!" to it. To read this phrase, realize that
|
||||
; REBOL collects terms from right to left, so "Hello!" is stored for
|
||||
; future use, then the prompt string "Variable name? " is used as the
|
||||
; argument to ask (prompts user for input). The result of ask is
|
||||
; converted to a word so it can be an identifier, then the 'set' word
|
||||
; accepts the new word and the string ("Hello!") to be assigned.
|
||||
|
||||
set to-word ask "Variable name? " "Hello!"
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
>> s = "myusername"
|
||||
myusername
|
||||
>> $$.[s] = 10;
|
||||
>> myusername
|
||||
10
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
: newVariable: ( "- )
|
||||
getToken header 0 , ;
|
||||
|
||||
newVariable: foo
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
: newVariable: ( "- )
|
||||
create 0 , ;
|
||||
|
||||
newVariable: foo
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
* # Get var name from user
|
||||
output = 'Enter variable name:'
|
||||
invar = trim(input)
|
||||
|
||||
* # Get value from user, assign
|
||||
output = 'Enter value:'
|
||||
$invar = trim(input)
|
||||
|
||||
* Display
|
||||
output = invar ' == ' $invar
|
||||
end
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
define: #name -> (query: 'Enter a variable name: ') intern. "X"
|
||||
define: name -> 42.
|
||||
X print.
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
Local varName,value
|
||||
InputStr "Variable name", varName
|
||||
Prompt value
|
||||
value → #varName
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
$$ MODE TUSCRIPT
|
||||
ASK "Enter variablename": name=""
|
||||
ASK "Enter value": value=""
|
||||
TRACE +@name
|
||||
@name=$value
|
||||
PRINT @name
|
||||
Loading…
Add table
Add a link
Reference in a new issue