Tuples are a simple and versatile data structure in Rust that allow you to group multiple values of different types into a single compound value. They are particularly useful for returning multiple values from a function.
Tuples can return multiple values of different types, which is not possible with arrays or slices. For example a tuple could be (i32, f64, String)
which contains an integer, a float, and a string.
In this challenge, you will implement a function that takes three arguments of different types and returns them as a tuple.
You need to implement the function create_tuple(a: i32, b: f64, c: &str) -> (i32, f64, String)
that takes an integer i32
, a float f64
, and a string slice &str
as input and returns them as a tuple. The string slice should be converted into a String
type.
create_tuple
function should return a tuple containing the three input values in order.String
before returning.()
to define and return the tuple.&str
to String using String::from()
or the .to_string()
method.VenerisAsgard
pub fn create_tuple(a: i32, b: f64, c: &str) -> (i32, f64, String) { return (a, b, String::from(c))}
hbdo
pub fn create_tuple(a: i32, b: f64, c: &str) -> (i32, f64, String) { // TODO: Implement the function here (a, b, String::from(c))}
infamous-711
pub fn create_tuple(a: i32, b: f64, c: &str) -> (i32, f64, String) { // TODO: Implement the function here (a, b, c.to_string())}
kriskwiatkowski
pub fn create_tuple(a: i32, b: f64, c: &str) -> (i32, f64, String) { return (a,b,String::from(c));}
jhq223
pub fn create_tuple(a: i32, b: f64, c: &str) -> (i32, f64, String) { // TODO: Implement the function here (a,b, c.to_string())}
francisco-cmyk
pub fn create_tuple(a: i32, b: f64, c: &str) -> (i32, f64, String) { return (a, b, String::from(c))}
xbarnett
pub fn create_tuple(a: i32, b: f64, c: &str) -> (i32, f64, String) { // TODO: Implement the function here (a, b, String::from(c))}
arukanoido
pub fn create_tuple(a: i32, b: f64, c: &str) -> (i32, f64, String) { // TODO: Implement the function here (a, b, c.to_string())}
Masber
pub fn create_tuple(a: i32, b: f64, c: &str) -> (i32, f64, String) { // TODO: Implement the function here (a, b, c.to_string())}
carlos-quantexai
pub fn create_tuple(a: i32, b: f64, c: &str) -> (i32, f64, String) { // TODO: Implement the function here let new_tuple = (a, b, c.to_string()); new_tuple}
mk-comm
pub fn create_tuple(a: i32, b: f64, c: &str) -> (i32, f64, String) { // TODO: Implement the function here (a,b,c.to_string())}
nordicmachine
pub fn create_tuple(a: i32, b: f64, c: &str) -> (i32, f64, String) { // TODO: Implement the function here return (a, b, String::from(c))}
oTTeuMsTudio
pub fn create_tuple(a: i32, b: f64, c: &str) -> (i32, f64, String) { // TODO: Implement the function here (a, b, String::from(c))}
majesticalcreature
pub fn create_tuple(a: i32, b: f64, c: &str) -> (i32, f64, String) { // TODO: Implement the function here (a, b, String::from(c))}
ad0x99
pub fn create_tuple(a: i32, b: f64, c: &str) -> (i32, f64, String) { // TODO: Implement the function here (a, b, c.to_string())}
josschne
pub fn create_tuple(a: i32, b: f64, c: &str) -> (i32, f64, String) { // TODO: Implement the function here (a, b, c.to_string())}
sander-b-postnl
pub fn create_tuple(a: i32, b: f64, c: &str) -> (i32, f64, String) { (a, b, c.to_owned())}
matei
pub fn create_tuple(a: i32, b: f64, c: &str) -> (i32, f64, String) { (a, b, String::from(c))}
rot11
pub fn create_tuple(a: i32, b: f64, c: &str) -> (i32, f64, String) { // TODO: Implement the function here (a, b, c.to_string())}
hendrikdevloed
pub fn create_tuple(a: i32, b: f64, c: &str) -> (i32, f64, String) { // TODO: Implement the function here (a, b, c.to_string())}
amassare
pub fn create_tuple(a: i32, b: f64, c: &str) -> (i32, f64, String) { // TODO: Implement the function here (a,b,c.to_string())}
zavakid
pub fn create_tuple(a: i32, b: f64, c: &str) -> (i32, f64, String) { // TODO: Implement the function here (a, b, c.into())}
victorchukwuemeka
pub fn create_tuple(a: i32, b: f64, c: &str) -> (i32, f64, String) { // TODO: Implement the function here (a, b, String::from(c))}
Johnchoi913
pub fn create_tuple(a: i32, b: f64, c: &str) -> (i32, f64, String) { // TODO: Implement the function here (a, b, c.to_string())}
Parallaxes
pub fn create_tuple(a: i32, b: f64, c: &str) -> (i32, f64, String) { // TODO: Implement the function here (a, b, String::from(c))}
MosesMp3
pub fn create_tuple(a: i32, b: f64, c: &str) -> (i32, f64, String) { return (a,b,String::from(c));}
brum-b0
pub fn create_tuple(a: i32, b: f64, c: &str) -> (i32, f64, String) { // TODO: Implement the function here (a, b, String::from(c))}
i5-650
pub fn create_tuple(a: i32, b: f64, c: &str) -> (i32, f64, String) { // TODO: Implement the function here ( a, b, c.to_string() )}
retinotopic
pub fn create_tuple(a: i32, b: f64, c: &str) -> (i32, f64, String) { let mystr: String = c.to_string(); return (a,b,mystr);}
hhornbacher
pub fn create_tuple(a: i32, b: f64, c: &str) -> (i32, f64, String) { // TODO: Implement the function here (a, b, c.into())}
ogaca42
pub fn create_tuple(a: i32, b: f64, c: &str) -> (i32, f64, String) { (a,b, c.to_string())}
Ustin
pub fn create_tuple(a: i32, b: f64, c: &str) -> (i32, f64, String) { // TODO: Implement the function here (a,b,c.to_string())}
pbjarterot
pub fn create_tuple(a: i32, b: f64, c: &str) -> (i32, f64, String) { // TODO: Implement the function here (a, b, c.to_string())}
CianciuStyles
pub fn create_tuple(a: i32, b: f64, c: &str) -> (i32, f64, String) { // TODO: Implement the function here (a, b, c.to_string())}
ayushrawat10
pub fn create_tuple(a: i32, b: f64, c: &str) -> (i32, f64, String) { // TODO: Implement the function here (a, b, String::from(c))}
AsymetricData
pub fn create_tuple(a: i32, b: f64, c: &str) -> (i32, f64, String) { // TODO: Implement the function here let s = String::from(c); (a, b, s)}
otherJL0
pub fn create_tuple(a: i32, b: f64, c: &str) -> (i32, f64, String) { (a, b, c.to_string())}
l3vith
pub fn create_tuple(a: i32, b: f64, c: &str) -> (i32, f64, String) { // TODO: Implement the function here (a, b, c.to_string())}
damascussteel21
pub fn create_tuple(a: i32, b: f64, c: &str) -> (i32, f64, String) { // TODO: Implement the function here (a, b, c.to_string())}
agegorin
pub fn create_tuple(a: i32, b: f64, c: &str) -> (i32, f64, String) { (a, b, c.to_string())}
daanbouwman19
pub fn create_tuple(a: i32, b: f64, c: &str) -> (i32, f64, String) { // TODO: Implement the function here (a,b, c.to_string())}
fuuman
pub fn create_tuple(a: i32, b: f64, c: &str) -> (i32, f64, String) { // TODO: Implement the function (a, b, String::from(c))}
Araden14
pub fn create_tuple(a: i32, b: f64, c: &str) -> (i32, f64, String) { // TODO: Implement the function here let tuple : (i32, f64, String) = (a, b, c.to_string()); tuple}
alexromanov
pub fn create_tuple(a: i32, b: f64, c: &str) -> (i32, f64, String) { // TODO: Implement the function here (a, b, c.to_string())}
LaurentiuStoleriu
pub fn create_tuple(a: i32, b: f64, c: &str) -> (i32, f64, String) { // TODO: Implement the function here let t: (i32, f64, String) = (a, b, String::from(c)); t}
hanneskuettner
pub fn create_tuple(a: i32, b: f64, c: &str) -> (i32, f64, String) { // TODO: Implement the function here return (a, b, String::from(c));}
Timepatterns
pub fn create_tuple(a: i32, b: f64, c: &str) -> (i32, f64, String) { // TODO: Implement the function here (a,b,c.to_string())}
shbhmrzd
pub fn create_tuple(a: i32, b: f64, c: &str) -> (i32, f64, String) { // TODO: Implement the function here (a,b,c.to_string())}
dev-puzzler
pub fn create_tuple(a: i32, b: f64, c: &str) -> (i32, f64, String) { // TODO: Implement the function here (a, b, c.to_string())}
CountJung
pub fn create_tuple(a: i32, b: f64, c: &str) -> (i32, f64, String) { // TODO: Implement the function here let tuple =(a,b,c.to_string()); tuple}